当我尝试做的时候,我正处于异常之下
driver.findElements(By.xpath("//button/span[text()='Cancel']/../following-sibling::button/span[text()='Ok']")).size()!=0
。
虽然我也在其他地方使用driver.findElements
,但它在这里失败了。
Chrome: 58x version
ChromeDriver: 2.29 version
Selenium: 2.52 version
错误追溯:
org.openqa.selenium.WebDriverException:未知错误:未处理的检查员错误:{“code”: - 32000,“message”:“无法找到具有指定ID的上下文”} (会议信息:chrome = 58.0.3029.110) (驱动程序信息:chromedriver = 2.29.461591(62ebf098771772160f391d75e589dc567915b233),platform = Windows NT 10.0.14393 x86_64)(警告:服务器未提供任何堆栈跟踪信息) 命令持续时间或超时:5.44秒 构建信息:版本:'2.47.1',修订版:'411b314',时间:'2015-07-30 03:03:16' 系统信息:主机:'Iaglab2',ip:'',os.name:'Windows 8.1',os.arch:'amd64',os.version:'6.3',java.version:'1.7.0_75' ***元素信息:{Using = xpath,value = // button / span [text()='Cancel'] /../ follow-sibling :: button / span [text()='Ok']} 会话ID:44c20fabdca96942ee2f9de6fc7d3c23 驱动程序信息:org.openqa.selenium.chrome.ChromeDriver 功能[{platform = WIN8_1,acceptSslCerts = true,javascriptEnabled = true,browserName = chrome,chrome = {userDataDir = C:\ Users \ hravi \ AppData \ Local \ Temp \ scoped_dir9172_8986,chromedriverVersion = 2.29.461591(62ebf098771772160f391d75e589dc567915b233)},networkConnectionEnabled = false,unexpectedAlertBehaviour =,rotate = false,locationContextEnabled = true,versionEmulationEnabled = false,version = LooStrategy = normal,takesHeapSnapshot = true,cssSelectorsEnabled = true,databaseEnabled = false,handlesAlerts = true,browserConnectionEnabled = false,webStorageEnabled = true,nativeEvents = true,hasTouchScreen = false,applicationCacheEnabled = false,takesScreenshot = true}]
答案 0 :(得分:1)
看起来这是Chrome驱动程序的错误。
但是这个错误已经修复了Chrome驱动程序v2.21。但我们又面临着类似的问题。我面临同样的问题2.30甚至最新的2.32版本。
答案 1 :(得分:1)
或者,您可以“忽略”此异常,因此除了NoSuchElementException:之外,您可以概括所有异常
max_connections
它对我有用