简体   繁体   中英

Xpath not valid with Selenium Webdriver “Xpath not found”

I am using the Selenium WebDriver for VBA to get some information from a website, but first I need to select a "category" and click a button, no problem i've been doing that a few times, but on this website the XPath does not return a valid object.

I suspect the website is a "dynamic format" and it breaks the XPath

How do I navigate to the button and click it when it's path is not valid?

Line of code that is not working: driver.FindElementByXPath("//div[@id=""buttonBar""]/td").Click

website: http://www.ocepar.org.br/ocepar/cooperativasPR/consultaPorRamo.html

The button is the "continuar" on the botton of the page

Thanks for the help!

You first need to set the context on the frame to access the button:

Dim driver As New FirefoxDriver
driver.Get "http://www.ocepar.org.br/ocepar/cooperativasPR/consultaPorRamo.html"
driver.SwitchToFrame "buttons"
driver.FindElementById("buttonBar").Click

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM