我使用Selenium从一个网站获取一些信息,但是首先我需要选择一个“类别”并点击一个按钮,没有问题,我已经做了几次,但在这个网站上,XPath不返回一个有效的对象。
我怀疑该网站是一种“动态格式”,它破坏了XPath
当该按钮的路径无效时,如何导航到该按钮并单击它?
不工作的代码行: driver.FindElementByXPath("//div@id=""buttonBar""/td").Click
网址:http://www.ocepar.org.br/ocepar/cooperativasPR/consultaPorRamo.html
按钮是页面按钮上的“连续”。
谢谢你的帮助!
发布于 2016-05-11 13:44:19
首先需要设置框架上的上下文以访问按钮:
Dim driver As New FirefoxDriver
driver.Get "http://www.ocepar.org.br/ocepar/cooperativasPR/consultaPorRamo.html"
driver.SwitchToFrame "buttons"
driver.FindElementById("buttonBar").Clickhttps://stackoverflow.com/questions/37164087
复制相似问题