2017-06-29 91 views
1

有時候,由於頁面加載超時,我的自動測試失敗。 我不知道這個問題是不是與網站,但我的自動化測試腳本做一些,因爲頁面:Selenium中的頁面加載超時

  • 即使當我改變了頁面加載超時30秒,說50,錯誤的頻率似乎是差不多的
  • 當我訪問該網站手動將其永遠沒有那麼長。當我殺了自動化測試在加載網頁的同時,它完成加載和顯示頁面罰款加載頁面
  • 有時候,我可以看到頁面仍在從瀏覽器選項卡加載,但頁面內容已滿y顯示

有沒有人遇到過這個問題?

我使用:

  • 硒的Java:2.53.1
  • Chrome的驅動程序:2.30
  • 硒:4.5

我用webDriver.get(url);方法打開瀏覽器中的URL。

以下是錯誤的追溯:

org.openqa.selenium.TimeoutException:超時 (會話信息:鉻= 59.0.3071.86) (駕駛員信息:chromedriver = 2.29.461591 (62ebf098771772160f391d75e589dc567915b233),平臺= Windows NT的10.0.10586 x86_64的)(警告:服務器未提供任何信息棧跟蹤) 命令持續時間或超時:50.81秒 在sun.reflect.NativeConstructorAccessorImpl.newInstance0(本機方法) 在陽光下。 reflect.NativeConstructorAccessorImpl.newInstance(那提veConstructorAccessorImpl.java:62) 在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 在java.lang.reflect.Constructor.newInstance(Constructor.java:422) 在org.openqa.selenium.remote。 ErrorHandler.createThrowable(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) at org .springframework.aop.framework.CglibAopProxy $ CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721) 在org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(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.proceed(ReflectiveMethodInvocation。Java的:179) 在org.springframework.aop.framework.CglibAopProxy $ DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656) 在org.openqa.selenium.remote.RemoteWebDriver $$ EnhancerBySpringCGLIB $$ c8c4bedf.get()

+0

你能否將selenium-java更新到3.4以及chrome瀏覽器並檢查? –

+0

它總是超時的頁面嗎?嘗試顯示數據的頁面每次頁面加載時都會發生變化? –

+0

@mandarin你已經明確提到過'Chrome Driver:2.30',但你的錯誤堆棧跟蹤提到'chromedriver = 2.29.461591'。嘗試將Selenium升級到v3.4.0。謝謝 – DebanjanB

回答

1

由於chrome驅動程序與硒的不兼容問題,我遇到了同樣的問題。嘗試更新您的chrome驅動程序。

-1

您的代碼沒有問題。我認爲您應該嘗試將Chrome驅動程序更新到最新版本,然後查看問題是否仍然存在。請讓我知道更新。

+1

這個答案沒有提供任何與已經存在的答案不同的東西。 – JeffC