gpt4 book ai didi

internet-explorer - IE 的 Selenium WebDriver 错误

转载 作者:行者123 更新时间:2023-12-04 08:36:32 24 4
gpt4 key购买 nike

我正在尝试使用 selenium webdriver、junit 和 ant build 自动化测试用例。从早上开始我就收到奇怪的错误。测试用例包含按钮单击命令。测试在 Chrome 和 FF 上运行成功,但在 IE 上不成功。之前至少说找不到某个元素X,但是这个说服务器没有提供任何信息。

Testcase: testMethod took 10.342 sec
Caused an ERROR
Cannot click on element (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 172 milliseconds
Build info: version: '2.23.1', revision: '17143', time: '2012-06-08 18:59:04'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_33'
Driver info: driver.version: RemoteWebDriver
Session ID: 8dfc5072-2755-40a7-bb32-05708c51101f
com.thoughtworks.selenium.SeleniumException: Cannot click on element (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 172 milliseconds
Build info: version: '2.23.1', revision: '17143', time: '2012-06-08 18:59:04'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_33'
Driver info: driver.version: RemoteWebDriver
Session ID: 8dfc5072-2755-40a7-bb32-05708c51101f
at org.openqa.selenium.internal.seleniumemulation.SeleneseCommand.apply(SeleneseCommand.java:41)
at org.openqa.selenium.internal.seleniumemulation.Timer.run(Timer.java:38)
at org.openqa.selenium.WebDriverCommandProcessor.execute(WebDriverCommandProcessor.java:144)
at org.openqa.selenium.WebDriverCommandProcessor.doCommand(WebDriverCommandProcessor.java:74)
at com.thoughtworks.selenium.DefaultSelenium.click(DefaultSelenium.java:193)
at dmswebui.IE.TestLogin.testMethod(TestLogin.java:19)
Caused by: org.openqa.selenium.ElementNotVisibleException: Cannot click on element (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 172 milliseconds
Build info: version: '2.23.1', revision: '17143', time: '2012-06-08 18:59:04'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_33'
Driver info: driver.version: RemoteWebDriver
Session ID: 8dfc5072-2755-40a7-bb32-05708c51101f
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:188)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:458)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:244)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:77)
at org.openqa.selenium.internal.seleniumemulation.Click.handleSeleneseCommand(Click.java:36)
at org.openqa.selenium.internal.seleniumemulation.Click.handleSeleneseCommand(Click.java:1)
at org.openqa.selenium.internal.seleniumemulation.SeleneseCommand.apply(SeleneseCommand.java:32)

最佳答案

我注意到以下异常

Caused by: org.openqa.selenium.ElementNotVisibleException: Cannot click on element

当您单击的元素在页面中被遮挡或隐藏时,通常会发生这种情况。 WebDriver 使用 native 事件,因此每当您要求它对隐藏的 WebElement 执行操作时都会失败。

这在 Selenium RC 中不是问题,因为它部署了合成事件(JS 事件)并且可以模拟对任何 DOM 元素的点击,而不管其可见性。

关于internet-explorer - IE 的 Selenium WebDriver 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11060033/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com