I'm using chimp.js which enhances webdriver.io with some fibers magic so that the code can be defined in a synchronous way. This is the code:
var c = require('./config');
module.exports = function () {
this.When(/^I try to login with wrong credentials$/, function () {
browser.setValue(userNameField, wrongUser);
browser.setValue(passwordField, wrongPassword);
browser.click('button[value="Login"]');
});
this.When(/^I try to login with the correct credentials$/, function () {
browser.setValue(userNameField, c.userName);
browser.setValue(passwordField, c.password);
console.log('before pressig the button');
browser.click('button[value="Login"]');
console.log('logged in');
});
};
The first When executes just fine. The second When also works, I just don't get to see
logged in
on the console. Both run on the same website, and both click on the same button. In the second case, after the login succeeds, the browser is redirected to an angular SPA. Here everything loads up correctly, but that's it. The callback never happens.
Running the tests with --debug --log=command I saw this to be the last line (before the timeout)
[1;30m[01:30:18]: [0m [0;35mCOMMAND [0mPOST "/wd/hub/session/7c334efe-2417-4184-b43c-082ba4441291/element/11/click"
switching log-level to verbose, and waiting for ~5min I got the following error:
[chimp][selenium.stderr] 01:36:59.561 DEBUG - Executed: [0560aaa14e4cf874afd72336c19e299b, clickElement {id=0.6384125368203968-3}]
[chimp][selenium.stderr] 01:37:02.449 WARN - Exception thrown
org.openqa.selenium.TimeoutException: timeout: Timed out receiving message from renderer: 10.000
(Session info: chrome=47.0.2526.73)
(Driver info: chromedriver=2.19.346063 (38b35413bd4a486d436a9749e090454bc9ff6708),platform=Mac OS X 10.11.0 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 310.12 seconds
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: '<HOST_NAME>', ip: '<IP_ADDRESS>', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11', java.version: '1.8.0_20'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=/var/folders/nc/3cdxbvwj44j_gk1qj24mbr5w0000gn/T/.org.chromium.Chromium.1n3kHd}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=47.0.2526.73, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 0560aaa14e4cf874afd72336c19e299b
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:273)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement$1.invoke(EventFiringWebDriver.java:332)
at com.sun.proxy.$Proxy3.click(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.click(EventFiringWebDriver.java:345)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.openqa.selenium.remote.server.KnownElements$1.invoke(KnownElements.java:64)
at com.sun.proxy.$Proxy2.click(Unknown Source)
at org.openqa.selenium.remote.server.handler.ClickElement.call(ClickElement.java:30)
at org.openqa.selenium.remote.server.handler.ClickElement.call(ClickElement.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[chimp][selenium.stderr] 01:37:02.458 WARN - Exception: timeout: Timed out receiving message from renderer: 10.000
(Session info: chrome=47.0.2526.73)
(Driver info: chromedriver=2.19.346063 (38b35413bd4a486d436a9749e090454bc9ff6708),platform=Mac OS X 10.11.0 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 310.12 seconds
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: '<HOST_NAME>', ip: '<IP_ADDRESS>', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11', java.version: '1.8.0_20'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=/var/folders/nc/3cdxbvwj44j_gk1qj24mbr5w0000gn/T/.org.chromium.Chromium.1n3kHd}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=47.0.2526.73, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 0560aaa14e4cf874afd72336c19e299b
[chimp][selenium.stderr] 01:37:02.471 DEBUG - Finished: POST /session/e103e58b-7ac9-4c8d-8f65-1f60295231d9/element/11/click
It takes on average between 3-7s for the first page of the SPA to be loaded, data to be initialised, ... (chrome stops showing that the page is loading). The timeout is set to 10s so I thought to increase it, via
module.exports = function () {
this.BeforeScenario(function () {
browser.timeout('script', 60 * 1000);
browser.timeout('page load', 60 * 1000);
});
};
but that didn't help either. Any idea what I could do / try?
Just to clarify again - the login page is a simple static server-side rendered HTML. After the user is logged in, they are redirected to a SPA, which is based on Angular 1.4. Pressing the login button with wrong credentials works probably, because I don't get redirected to the SPA, but back to the login page.
And all tests are run in chrome, on Mac OS X El Capitan
Update:
Now it worked once. Afterwards I've noticed, that the script continues running, when I reload the website, in case it got stuck.
The page here in question works this way:
/ page is accessed and angular initialised
ui-router routes to #/defaultroute
Controller gets initialised and downloads some initial data
new controllers get initialised inside an ng-repeat and download even more data
So yeah, its quite a bit of data downloading and waiting for the whole page to show up. Maybe that's causing troubles for chimp.js or webdriver.io?
And of course, switching from browser.click(...); to browser.key(['Enter']); doesn't work either. The same problems with getting stuck and reloading the browser fixes it. It seems like silenium maybe doesn't get the the page actually finished loading. Which is why reloading the page fixes it. Any idea how to fix that?
Btw, I've also opened an issue about this: https://github.com/xolvio/chimp/issues/165
Update 2:
In Firefox and PhantomJS it works, Safari doesn't run at all.
Maybe at this point I'd just like to know where the error is, if it's a known bug, ...
What I would do to narrow down the problem:
Run single failing test in isolation (To make sure other tests are not affecting somehow)
Access failing tests final(redirected) url directly instead through button click. for example (smth like browser.get('#/defaultroute'));
Check if the angular page doesn't do polling (continuous setTimeout, interval) which might be treated as page not loaded/synced (doubt it because it works on refresh)
Related
I m trying to run the selenium scripts in jenkins(#localhost) using pom.xml but facing issues w.r.t chrome driver.
Chrome Version 52.0
Selenium-server 2.53.0
Below is the complete stacktrace:
================================================================
Tests run: 7, Failures: 1, Errors: 0, Skipped: 6, Time elapsed: 63.654 sec <<< FAILURE! - in TestSuite
init(com.arrk.pages.AppleTest) Time elapsed: 63.416 sec <<< FAILURE!
org.openqa.selenium.WebDriverException: unknown error: unable to discover open pages
=====================================================================
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.92 seconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'akshayk', ip: '10.0.2.58', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
=======================================================================
Driver info: org.openqa.selenium.chrome.ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:144)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:159)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:116)
at com.arrk.webdriver.WebDriverFactory.getInstance(WebDriverFactory.java:125)
at com.arrk.webdriver.WebDriverFactory.getInstance(WebDriverFactory.java:64)
at com.arrk.pages.TestBase.init(TestBase.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:170)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104)
at org.testng.TestRunner.privateRun(TestRunner.java:774)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1048)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:217)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:92)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Tried every possible solution regarding this problem. If any more solution there then please let me know.
This looks similar to a bug report on Chrome 51-53:
org.openqa.selenium.remote.server.DriverServlet - Exception: unknown error: unable to discover open pages
That bug links to the main Chrome bug "Fails to navigate to URL when Chrome 51 is launched in session 0 / through CI". Launching a Jenkins slave installed as a Windows service uses session 0.
The gist is running Chrome from session 0 broke in Chrome 51. The short term workarounds include dropping back to Chrome 50 (if you can find it), or running with the Chrome option "no-sandbox", like so:
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddArguments("test-type");
chromeOptions.AddArguments("no-sandbox");
PropertiesCollection.driver = new ChromeDriver(chromeOptions);
A fix is expected in Chrome 54, however the bug response says they aren't planning long-term support for session 0. I am all ears if anyone knows how to launch a Jenkins slave from something other than session 0 on Windows.
When my script is trying to sendkeys for username after opening login page, I am getting disconnected: received Inspector.detached event error.
Console details:
SaveReport FAILED: SaveSearche org.openqa.selenium.WebDriverException:
disconnected: received Inspector.detached event (Session info:
chrome=49.0.2623.110) (Driver info: chromedriver=2.20.353145
(343b531d31eeb933ec778dbcf7081628a1396067),platform=Windows NT 6.1 SP1
x86_64) (WARNING: The server did not provide any stacktrace
information) Command duration or timeout: 334 milliseconds Build info:
version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'jp-anal-l01', ip: '182.178.5.177', os.name:
'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version:
'1.7.0_79' Session ID: b963137ae8a484c47efd3ac0984ea6b3 Driver info:
org.openqa.selenium.chrome.ChromeDriver Capabilities [{platform=XP,
acceptSslCerts=true, javascriptEnabled=true, browserName=chrome,
chrome={userDataDir=C:\Users\ANJH1.NA\Temp\dir10584}, rotatable=false,
locationContextEnabled=true, mobileEmulationEnabled=false,
version=49.0.2623.110, takesHeapSnapshot=true,
cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true,
browserConnectionEnabled=false, nativeEvents=true,
webStorageEnabled=true, hasTouchScreen=false,
applicationCacheEnabled=false, takesScreenshot=true}] at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source) at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source) at java.lang.reflect.Constructor.newInstance(Unknown Source)
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.RemoteWebElement.execute(RemoteWebElement.java:268)
at
org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:89)
at com.demoProject.loginAllTime(TestSuiteTestCases.java:99) at
com.demoProject.TestCases.SaveSearch(TestSuiteTestCases.java:317) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
java.lang.reflect.Method.invoke(Unknown Source) at
[snip]
at org.testng.TestRunner.privateRun(TestRunner.java:767) at org.testng.TestRunner.run(TestRunner.java:617)
[snip]
org.testng.TestNG.run(TestNG.java:1057) at
com.demoProject.executeTestCase(TestSuiteTestCases.java:99) at
com.demoProject.initialize(TestSuiteTestCases.java:56) at
com.demoProject.executeModules(TestSuiteTestCases.java:142) at
com.demoProject.main(TestSuiteTestCases.java:98)
Without having the actual test code, my best guess is that com.demoProject.loginAllTime(), which is calling sendKeys(), must be sending either Ctrl-Shift-I, or Ctrl-Shift-J, or Ctrl-Shift-C, each of which will open the Chrome DevTools on Windows.
As mentioned in the comments, if DevTools is opened during a WebDriver run, ChromeDriver will be automatically disconnected, producing the error:
received Inspector.detached event
It doesn't seem to be possible to get that error any other way.
This is about chrome issue(https://bugs.chromium.org/p/chromedriver/issues/detail?id=1194).
When you are running selenium program, you cannot press F12 to open dev tools manually, or it'll throw this exception sometimes.
According to the issue list, it looks like fixed, but I still meet this bug in ChromeDriver 2.29
Check if Chrome->Developer Tools are enabled.
One of my E2E Test is failing only on Safari browser, when trying to send Text to an inputBox.
element(by.css('#content')).clear();
element(by.css('#content')).sendKeys("%20%DCben%20von%20Xylophonmusik%20qu%E4lt%20jeden%20gr%F6%DFeren%20Zwerg%20El%20ping%FCino%20Wenceslao%20hizo%20kil%F3metros%20bajo%20exhaustiva%20ll"); //UTF Text
Seeing following error in Webdriver manager console
18:40:12.150 INFO - Executing: [send keys: 16 [[SafariDriver: safari
on MAC (null)] -> css selector: #contentText],
[Falsches%20%DCben%20von%20Xylophonmusik%20qu%E4lt%20jeden%20gr%F6%DFeren%20Zwerg%20El%20ping%FCino%20Wenceslao%20hizo%20kil%F3metros%20bajo%20exhaustiva%20lluvia%20y%20%0A%200c%F4t%E9%20de%20l%27alc%F4ve%20ovo%EFde%2C%20o%F9%20les%20b%FBche%u0E40%u18:40:42.663
WARN - Exception thrown org.openqa.selenium.TimeoutException: Timed
out awaiting response to command "sendKeysToElement" after 30004 ms
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 30.02 seconds Build info: version:
'2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50' System
info: host: 'vq-mac-dt-036.local', ip: '10.21.134.62', os.name: 'Mac
OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version:
'1.8.0_31' Driver info: org.openqa.selenium.safari.SafariDriver
Capabilities [{browserName=safari, takesScreenshot=true,
javascriptEnabled=true, version=7.0.6, cssSelectorsEnabled=true,
platform=MAC, secureSsl=true}] Session ID: null at
sun.reflect.GeneratedConstructorAccessor57.newInstance(Unknown Source)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.openqa.selenium.remote.ErrorHandler.createThrowa18:40:42.664
WARN - Exception: Timed out awaiting response to command
"sendKeysToElement" after 30004 ms (WARNING: The server did not
provide any stacktrace information) Command duration or timeout: 30.02
seconds
This test is working in Firefox, Chrome Browsers. I can't find any open issue related to safari driver.
Could you please advise, how to resolve this.
Thanks in advance.
Try chaining the clear, click and sendKeys functions on the input box to send the value. I don't think the UTF8 text should cause any problem. Here's how to do it -
var ele = element(by.css('#content'));
ele.clear().then(function(){
ele.click().then(function(){
ele.sendKeys("%20%DCben%20von%20Xylophonmusik%20qu%E4lt%20jeden%20gr%F6%DFeren%20Zwerg%20El%20ping%FCino%20Wenceslao%20hizo%20kil%F3metros%20bajo%20exhaustiva%20ll"); //UTF Text
});
});
Hope this helps.
org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Command duration or timeout: 21 milliseconds
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
System info: os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.7.0_25'
Session ID: 16492097-714b-42c4-b9dc-2c3979db180f
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=XP, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, browserConnectionEnabled=true, nativeEvents=true, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=22.0}]
The results of the executed scripts are not consistent. Sometimes it passes, and sometime it throws the exception mentioned above.
The script result is not same because the element might talking different amount of time for appear on page.
Using sleep can solve the problem but that is not good practice as you may have to adjust/increase the value if test case failed even after giving sleep.
Better use wait for element functionality.
Refer document # "http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp" for details
yes You need to use a conditional wait , so that your code will wait until it locates the element.
For Example:If you are using web-driver
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("username")));
I don't understand how can this be. The error sometimes disappears but mostly it is actual. Selenium logs show the following:
Element not found with xpath, //html
Unable to locate element: {"method":"xpath","selector":"//html"}
Command duration or timeout: 1.24 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '2.6.32-5-686', java.version: '1.7.0_11'
Session ID: cbfc080e-f4a9-4ec9-aa72-3a8adeb0e9b9
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=LINUX, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, browserConnectionEnabled=true, nativeEvents=false, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=17.0}] [] []
Thanks in advance for any help!
UPDATE
I figured out that the problem is only actual for the following versions of the Selenium server:
selenium-server-standalone-2.31.0.jar
selenium-server-standalone-2.32.0.jar
selenium-server-standalone-2.28.0.jar works fine with such XPath locators.
I had the same problem and I have fixed these random errors, with two actions:
I have added the tag #insulated on all my features. It closes the browser for each scenario. You can find most informations on the Behat documentation.
Then, I have added the option --rerun when I execute Behat because I have few random errors on few random scenarios. There are the options in the manual (./behat --help). Quickly, you can execute behat with this option like this : bin/behat [#NamespaceMyBundle[/myFeature.feature]] --rerun .behat_rerun. (bin/behat because I use behat in a Symfony2 project and I launch the command from top directory).
A third option that I don't have implemented but is recommended on Behat doc, is to implement a spin() method which will scan and wait if an element is not available. The blog post is available here.
Two ideas:
Try changing the xpath to /html
Try changing the find method to findElement(By.ByTagName("html"));
If the error is intermittent, is it possibly because webdriver is trying to find the element before the page has loaded? If you stick an appropriate wait in there, does it get rid of the error?