0
我正在使用PHPUnit(3.7.38),Selenium2(2.43.1-standalone)和Firefox(34.0)測試站點,並且一直運行到Selenium的間歇性問題能夠在頁面上找到標籤。如果我截取了錯誤的截圖,標籤和內容就在那裏,並且頁面看起來好像完全加載了。我試圖加載會導致問題的標籤上沒有提及AJAX。PHPUnit Selenium2無法在測試中查找標記
這似乎發生在大約50%的時間和一些特定的測試。同樣,它似乎傾向於測試的特定線條,但通常會改變線條,如果我註釋掉違規線。如果我在兩次測試之間等待幾分鐘,它似乎運行沒有錯誤,但除此之外,我找不到任何影響它的事情。
具體的例外是:
PHPUnit_Extensions_Selenium2TestCase_WebDriverException: Unable to locate element: {"method":"tag name","selector":"h2"}
硒跟蹤:
22:32:34.544 INFO - Executing: [find element: By.tagName: h2])
22:32:35.704 WARN - Exception thrown org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"tag name","selector":"h2"}
Command duration or timeout: 220 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
System info: host: 'andrew-xubuntu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-43-generic', java.version: '1.7.0_65'
Session ID: e842f08c-176e-4361-859b-8fc8e67b8d5c
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=LINUX, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, webStorageEnabled=true, nativeEvents=false, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=34.0}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:352)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByTagName(RemoteWebDriver.java:417)
at org.openqa.selenium.By$ByTagName.findElement(By.java:330)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:344)
at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:101)
at com.sun.proxy.$Proxy1.findElement(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver.findElement(EventFiringWebDriver.java:184)
at org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:47)
at org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:169)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"tag name","selector":"h2"}
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
System info: host: 'andrew-xubuntu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-43-generic', java.version: '1.7.0_65'
Driver info: driver.version: unknown
at <anonymous class>.FirefoxDriver.prototype.findElementInternal_(file:///tmp /anonymous8627931668853884881webdriver-profile/extensions/[email protected]/components/driver-component.js:9618:26)
at <anonymous class>.FirefoxDriver.prototype.findElement(file:///tmp/anonymous8627931668853884881webdriver-profile/extensions/[email protected]/components/driver-component.js:9627:3)
at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///tmp/anonymous8627931668853884881webdriver-profile/extensions/[email protected]/components/command-processor.js:11612:16)
at <anonymous class>.DelayedCommand.prototype.executeInternal_(file:///tmp/anonymous8627931668853884881webdriver-profile/extensions/[email protected]/components/command-processor.js:11617:7)
at <anonymous class>.DelayedCommand.prototype.execute/<(file:///tmp/anonymous8627931668853884881webdriver-profile/extensions/[email protected]/components/command-processor.js:11559:5)
22:32:35.706 WARN - Exception: Unable to locate element: {"method":"tag name","selector":"h2"}
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
System info: host: 'andrew-xubuntu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-43-generic', java.version: '1.7.0_65'
Driver info: driver.version: unknown`