408为什么不能java,HTTP状态:“ 500”->使用IEDriverServer Selenium和Java单击元素时,“超时”(预期为408)的JSON状态映射不正确...

Below are the details related to my flow -

Page - 1 - Login to Web page

After login, a URL Appears (Lets call it Element 1)

After clicking Element 1, web page loads again and there I need to click on a different element, (Lets call it Element 2).

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"

But instead I get exception.

Code -

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 ");`

System Details -

InternetExplorerDriver server (64-bit) 3.14.0.0

Os name: 'Windows 10'

Java version: '1.8.0_191'

Other Details -

Please note that after clicking on Element 1, I use driver.switchTo().defaultContent();

Error Details -

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值