Selenium webdriver Selenium xpath谷歌搜索

Selenium webdriver Selenium xpath谷歌搜索,selenium-webdriver,xpath,Selenium Webdriver,Xpath,Selenium webdriver无法使用xpath找到类似google搜索按钮的元素。 findElement(By.xpath(“//button[@type='button']))。单击() 这对我有用 findElement(By.xpath(//following::*[@value='googlesearch'][2]”)。单击() 尝试此操作,按文本查找按钮。 “//button[text()='some text']”代码中没有开头双引号。此外,目标按钮是动态的,所以您需要等到

Selenium webdriver无法使用xpath找到类似google搜索按钮的元素。 findElement(By.xpath(“//button[@type='button']))。单击()

这对我有用


findElement(By.xpath(//following::*[@value='googlesearch'][2]”)。单击()

尝试此操作,按文本查找按钮。
“//button[text()='some text']”

代码中没有开头双引号。此外,目标按钮是动态的,所以您需要等到它出现在DOM中\n即使存在同样的问题,它也不起作用。。