HTTP状态:"500"->使用IEDriverServer Selenium和Java单击元素时,“超时"的错误JSON状态映射不正确(预期为408) [英] HTTP Status: '500' -> incorrect JSON status mapping for 'timeout' (408 expected) while clicking element with IEDriverServer Selenium and Java
问题描述
以下是与我的流程相关的详细信息-
Below are the details related to my flow -
- 页面-1-登录到网页
- 登录后,出现一个URL(将其称为元素1)
- 单击元素1"后,网页将再次加载,因此我需要单击另一个元素(将其称为元素2").
问题-
驱动程序被卡住,或者元素1没有被单击,或者添加了足够的等待后,元素1被单击,但是现在驱动程序被卡在该流程中,您可以从下面的代码中观察到,一旦调用clickurl.click()
,那么10秒钟后我应该消息"睡眠已完成.现在返回调用类"
Problem -
Driver gets stuck, either Element 1 is not getting clicked or after adding sufficient wait Element 1 gets clicked but now driver gets stuck at this flow as you can observe from below code, once clickurl.click()
is called then after 10 seconds I should get a message that "Sleep Completed.. Now we return to calling class"
但是我得到了例外.
代码-
clickurl = d1.findElement(By.xpath("XPath for Element 1"));
if ( clickurl != null ) {
System.out.print("****** Clicking on it Directly ");
clickurl.click();
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.print("****** Sleep Completed.. Now we return to calling class ");`
系统详细信息-
- InternetExplorerDriver服务器(64位)3.14.0.0
- 操作系统名称:"Windows 10"
- Java版本:"1.8.0_191"
其他详细信息-
- 请注意,单击元素1后,我使用
driver.switchTo().defaultContent();
错误详细信息-
Dec 11, 2018 5:02:56 PM org.openqa.selenium.remote.ErrorCodes toStatus
INFO: HTTP Status: '500' -> incorrect JSON status mapping for 'timeout' (408 expected)
Exception in thread "main" org.openqa.selenium.TimeoutException: Timed out waiting for page to load.
推荐答案
尝试了多种操作并等待并使用上面答案中的设置后,我使用了下面的代码,即将鼠标移到元素上并执行单击操作.
After trying multiple things and waits and using the settings from above answer, I used below code i.e. Moving the mouse to element and the performing click operation.
Actions actions = new Actions(d1);
actions.moveToElement(clickurl).click().build().perform();
js.executeScript("arguments[0].click();",clickurl);
我使用以下问题得出了这个结论- 硒单击并不总是有效
I used below question to reach at this conclusion - Selenium click not always working
这篇关于HTTP状态:"500"->使用IEDriverServer Selenium和Java单击元素时,“超时"的错误JSON状态映射不正确(预期为408)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!