2
如果页面上不存在元素find_element_by_xpath()
需要太多的时间来挂起测试执行。有没有什么办法在python中设置超时到find_element_by_xpath()
函数?Selenium webdriver find_element_by_xpath花费时间
如果页面上不存在元素find_element_by_xpath()
需要太多的时间来挂起测试执行。有没有什么办法在python中设置超时到find_element_by_xpath()
函数?Selenium webdriver find_element_by_xpath花费时间
您可以使用此代码设置implicit wait -
ff = webdriver.Firefox()
ff.implicitly_wait(10) # seconds
这使得webdriver的等待10秒,当你试图找到网页上的元素在引发错误前。
让我以不同的方式提出这个问题..... – 2012-07-26 11:11:34