Reputation: 51
I'm trying to use chromedp to automate some process of open a web page and simulate clicking buttons and input text to finish some task, and I'm doing it in GUI mode (headless is set to false) so that I can see all the processes to confirm it gets my task done correctly.
The destination web site is using asp.net and the page I'm accessing is an aspx page. There are two buttons I would like to click. The first is in a popup area having text as "Accept all cookies". I can simulate clicking it by issuing the following command in development tool console:
document.GetElementById("onetrust-accept-btn-handler").click()
The second button is having a text as "book now". I can simulate clicking it by issuing the following command in the console:
document.getElementByClassName("btn btn-primary btn-xs")[0].click()
I tried the following code for the first button:
chromedp.Click(`button[@value="Accept All Cookies"]`, chromedp.NodeVisible),
Tried the following code for the second button:
chromedp.Click(`button[@value="book now"]`, chromedp.NodeVisible),
Both do not do the job. How do I construct the chromedp command to make the clicking happen?
Upvotes: 1
Views: 207