Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebDriver for Firefox: browser starts w/ empty page, hangs for 2 min, restarts, then test runs. Why?

I'm trying to update my Java test suite to use Selenium 3 and geckodriver. However, I see this very strange behavior on executing the test command:

  • Firefox opens up to a blank page.
  • It stays like this for about 2 minutes.
  • It closes and then immediately restarts.
  • The test runs and passes.

I use Selenium 3.0.1, geckodriver 0.11.1, Firefox 50.0 on 64-bit Linux.

I obtain FirefoxDriver like this:

DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
return new FirefoxDriver(capabilities);

I'm setting the system property webdriver.gecko.driver in my Maven conf:

<webdriver.gecko.driver>
  ${basedir}/src/test/resources/geckodriver
</webdriver.gecko.driver>

What could I be missing? Many thanks for any help!


Console logs for my tests (with three distinct timing groups):

around 3:54:30 PM

Full log: https://justpaste.it/10qn9

Key snippets:

Configuring TestNG with: TestNG652Configurator
[VerboseTestNG] RUNNING: Suite: "Surefire test" containing "1" Tests (config: null)
[VerboseTestNG] INVOKING CONFIGURATION: "Surefire test" - @BeforeClass com.example.MyTest.classSetUp()
[VerboseTestNG] PASSED CONFIGURATION: "Surefire test" - @BeforeClass com.example.MyTest.classSetUp() finished in 384 ms
[VerboseTestNG] INVOKING CONFIGURATION: "Surefire test" - @BeforeMethod com.example.MyTest.methodSetUp()
1479999268209   geckodriver INFO    Listening on 127.0.0.1:7263
Nov 24, 2016 3:54:28 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
1479999268435   mozprofile::profile INFO    Using profile path /tmp/rust_mozprofile.VYFzbHfCS7iH
1479999268438   geckodriver::marionette INFO    Starting browser /usr/bin/firefox
1479999268441   geckodriver::marionette INFO    Connecting to Marionette on localhost:56753
(firefox:2956): GLib-GObject-CRITICAL **: g_object_ref: assertion 'object->ref_count > 0' failed
(firefox:2956): GLib-GObject-CRITICAL **: g_object_unref: assertion 'object->ref_count > 0' failed
(firefox:2956): GLib-GObject-CRITICAL **: g_object_ref: assertion 'object->ref_count > 0' failed
(firefox:2956): GLib-GObject-CRITICAL **: g_object_unref: assertion 'object->ref_count > 0' failed
[...]
1479999269312   addons.manager  DEBUG   Completed startup sequence
1479999269598   Marionette  INFO    Listening on port 56753
1479999270046   addons.manager  DEBUG   Starting provider: <unnamed-provider>
1479999270046   addons.manager  DEBUG   Registering shutdown blocker for <unnamed-provider>
1479999270048   addons.manager  DEBUG   Provider finished startup: <unnamed-provider>
1479999270094   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1479999270094   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1479999270095   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
1479999270100   DeferredSave.extensions.json    DEBUG   Starting write
1479999270286   DeferredSave.extensions.json    DEBUG   Write succeeded
1479999270288   addons.xpi-utils    DEBUG   XPI Database saved, setting schema version preference to 17
(/usr/lib/firefox/plugin-container:3019): GLib-GObject-CRITICAL **: g_object_ref: assertion 'object->ref_count > 0' failed
(/usr/lib/firefox/plugin-container:3019): GLib-GObject-CRITICAL **: g_object_unref: assertion 'object->ref_count > 0' failed
(/usr/lib/firefox/plugin-container:3019): GLib-GObject-CRITICAL **: g_object_ref: assertion 'object->ref_count > 0' failed
(/usr/lib/firefox/plugin-container:3019): GLib-GObject-CRITICAL **: g_object_unref: assertion 'object->ref_count > 0' failed

around 3:55:32 PM

Full log:

1479999331434   addons.productaddons    INFO    sending request to: https://aus5.mozilla.org/update/3/GMP/50.0/20161114145022/Linux_x86_64-gcc3/null/release-cck- ubuntu/Linux%203.13.0-101-generic%20(GTK%203.10.8%2Clibpulse%204.0.0)/canonical/1.0/update.xml
1479999332144   addons.productaddons    INFO    Completed downloading document
1479999332573   addons.productaddons    INFO    downloadXHR File download. status=200
1479999332581   addons.productaddons    INFO    Downloaded file will be saved to /tmp/tmpaddon

around 3:56:35 PM

Full log:

Nov 24, 2016 3:56:35 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
[VerboseTestNG] PASSED CONFIGURATION: "Surefire test" - @BeforeMethod com.example.MyTest.methodSetUp() finished in 129531 ms
[VerboseTestNG] INVOKING: "Surefire test" - com.example.MyTest.testSomething()
[VerboseTestNG] PASSED: "Surefire test" - com.example.MyTest.testSomething() finished in 1603 ms
like image 682
Jan Żankowski Avatar asked Nov 24 '16 15:11

Jan Żankowski


1 Answers

This issues looks similar to previously identified issue. The recommendation is to use Selenium 3.3.1 and gecko driver greater than 0.14.

Adding to it Firefox 50 has a bug that affects timeouts in web driver injected scripts. This bug has been fixed, and should work in Firefox 51+

like image 97
ArunPrakash Avatar answered Oct 21 '22 09:10

ArunPrakash