Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Selenium中的页面加载超时_Java_Reactjs_Selenium_Selenium Webdriver_Automated Tests - Fatal编程技术网

Java Selenium中的页面加载超时

Java Selenium中的页面加载超时,java,reactjs,selenium,selenium-webdriver,automated-tests,Java,Reactjs,Selenium,Selenium Webdriver,Automated Tests,有时,由于页面加载超时,我的自动测试失败。 我想知道问题是否不在于网站,而在于我的自动测试脚本对页面做了些什么,因为: 即使我将页面加载超时改为30秒,比如说50秒,错误的频率似乎也差不多 当我手动访问网站时,加载一个页面从来不会花那么长时间 当我在加载页面的同时终止自动测试一段时间后,它会完成加载并显示页面 有时,我可以看到页面仍在从浏览器选项卡加载,但页面内容已完全显示 有人遇到过这个问题吗 我正在使用: selenium java:2.53.1 Chrome驱动程序:2.30 硒化物

有时,由于页面加载超时,我的自动测试失败。 我想知道问题是否不在于网站,而在于我的自动测试脚本对页面做了些什么,因为:

  • 即使我将页面加载超时改为30秒,比如说50秒,错误的频率似乎也差不多
  • 当我手动访问网站时,加载一个页面从来不会花那么长时间
  • 当我在加载页面的同时终止自动测试一段时间后,它会完成加载并显示页面
  • 有时,我可以看到页面仍在从浏览器选项卡加载,但页面内容已完全显示
有人遇到过这个问题吗

我正在使用:

  • selenium java:2.53.1
  • Chrome驱动程序:2.30
  • 硒化物:4.5
我使用
webDriver.get(url)方法在浏览器中打开URL

以下是错误回溯:

org.openqa.selenium.TimeoutException:超时 (会话信息:chrome=59.0.3071.86) (驱动程序信息:chromedriver=2.29.461591(62ebf098771772160f391d75e589dc567915b233),平台=Windows NT 10.0.10586 x8664)(警告:服务器未提供任何堆栈跟踪信息) 命令持续时间或超时:50.81秒 位于sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法) 位于sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 位于java.lang.reflect.Constructor.newInstance(Constructor.java:422) 位于org.openqa.selenium.remote.ErrorHandler.CreateTrowable(ErrorHandler.java:206) 位于org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) 位于org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678) 位于org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:316) 位于org.openqa.selenium.remote.RemoteWebDriver$$FastClassBySpringCGLIB$$589f8ff4.invoke() 位于org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) 位于org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721) 在org.springframework.aop.framework.ReflectiveMethodInvocation.procedue(ReflectiveMethodInvocation.java:157)上 位于org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133) 位于org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121) 在org.springframework.aop.framework.ReflectiveMethodInvocation.procedue(ReflectiveMethodInvocation.java:179)上 位于org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656) 在org.openqa.selenium.remote.RemoteWebDriver$$EnhancerBySpringCGLIB$$c8c4bedf.get()上


由于chrome驱动程序与selenium不兼容,我遇到了同样的问题。请尝试更新您的chrome驱动程序。

由于chrome驱动程序与selenium不兼容,我遇到了同样的问题。请尝试更新您的chrome驱动程序。

您的代码没有问题。我认为你应该尝试更新你的Chrome驱动程序到最新版本,看看这个问题是否仍然存在。请告诉我更新情况。

您的代码没有问题。我认为你应该尝试更新你的Chrome驱动程序到最新版本,看看这个问题是否仍然存在。请让我知道更新情况。

您能将selenium java更新到3.4和chrome浏览器并检查一下吗?超时的页面总是同一个页面吗?页面是否无法显示每次加载页面时都会发生变化的数据?@您明确提到了
Chrome驱动程序:2.30
,但您的错误堆栈跟踪提到了
chromedriver=2.29.461591
。尝试将Selenium升级到v3.4.0。谢谢你有答案吗?我偶尔遇到这个错误,你能把selenium java更新到3.4和chrome浏览器并检查一下吗?超时的页面总是同一个页面吗?页面是否无法显示每次加载页面时都会发生变化的数据?@您明确提到了
Chrome驱动程序:2.30
,但您的错误堆栈跟踪提到了
chromedriver=2.29.461591
。尝试将Selenium升级到v3.4.0。谢谢你有答案吗?我偶尔会遇到这个错误。这个答案与已经存在的答案没有任何不同。这个答案与已经存在的答案没有任何不同。