Cannot click on a tbody (Full Calendar) with chrome.ahk

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
embeddedhustler
Posts: 16
Joined: 07 May 2021, 13:27

Cannot click on a tbody (Full Calendar) with chrome.ahk

Post by embeddedhustler » 11 Jul 2022, 03:32

Hello,

I'm attempting to use an xpath to click on a tbody but am having no luck.

My click function looks like this

Code: Select all

click(xpath){
	
	WaitPageToLoad()
	checkFail()
	
	result := page.Evaluate("document.body.contains(document.evaluate('" xpath "', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue) ? 'true' : 'false'").value
	
	if(result = "true"){
		page.Evaluate("document.evaluate('" xpath "', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();")
	}else{
		MsgBox Error!
		Reload
	}
}
This is how the console looks

Image

This is how to website looks

Image

I am trying to click on those highlighted buttons.

This is the code:

Code: Select all

xp = /html/body/app-root/div/app-book-appointment/section/mat-card[1]/div[2]/div/div/full-calendar/div[2]/div/table/tbody/tr/td/div/div/div/table/tbody/tr[5]/td[1]
click(xp)
This doesn't have any effect. However, when I try to use plain js on the console like

Code: Select all

document.querySelector("body > app-root > div > app-book-appointment > section > mat-card:nth-child(1) > div.ba-calender-card.card.shadow-sm > div > div > full-calendar > div.fc-view-harness.fc-view-harness-active > div > table > tbody > tr > td > div > div > div > table > tbody > tr:nth-child(5) > td.fc-daygrid-day.fc-day.fc-day-mon.fc-day-future.date-availiable").click()
it returns undefined.

Can someone help me with this?

User avatar
neovis
Posts: 34
Joined: 12 Jun 2022, 03:56
Location: Republic of Korea
Contact:

Re: Cannot click on a tbody (Full Calendar) with chrome.ahk

Post by neovis » 11 Jul 2022, 11:08

The 'page' variable is not referenced. It must be passed as a parameter or referenced as a global variable.

embeddedhustler
Posts: 16
Joined: 07 May 2021, 13:27

Re: Cannot click on a tbody (Full Calendar) with chrome.ahk

Post by embeddedhustler » 13 Jul 2022, 16:44

neovis wrote:
11 Jul 2022, 11:08
The 'page' variable is not referenced. It must be passed as a parameter or referenced as a global variable.
it, of course, is.

User avatar
neovis
Posts: 34
Joined: 12 Jun 2022, 03:56
Location: Republic of Korea
Contact:

Re: Cannot click on a tbody (Full Calendar) with chrome.ahk

Post by neovis » 14 Jul 2022, 00:37

Using CSS Selector

Code: Select all

found := page.evaluate("document.querySelector('td.fc-day-future.date-availiable') ? 1 : 0").value
MsgBox % "found: " found

if (found)
    page.evaluate("document.querySelector('td.fc-day-future.date-availiable').click()")

embeddedhustler
Posts: 16
Joined: 07 May 2021, 13:27

Re: Cannot click on a tbody (Full Calendar) with chrome.ahk

Post by embeddedhustler » 15 Jul 2022, 07:58

neovis wrote:
14 Jul 2022, 00:37
Using CSS Selector

Code: Select all

found := page.evaluate("document.querySelector('td.fc-day-future.date-availiable') ? 1 : 0").value
MsgBox % "found: " found

if (found)
    page.evaluate("document.querySelector('td.fc-day-future.date-availiable').click()")
Image


User avatar
Xeo786
Posts: 760
Joined: 09 Nov 2015, 02:43
Location: Karachi, Pakistan

Re: Cannot click on a tbody (Full Calendar) with chrome.ahk

Post by Xeo786 » 16 Jul 2022, 00:19

Sometimes we need to dispatch mouse event to trigger such event listener
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory

Post Reply

Return to “Ask for Help (v1)”