简体   繁体   中英

Unable to open firefox browser in Jenkins using selenium webdriver

I'm using Selenium version 3.4.0 and geckodriver version 0.16.1 . My firfox version is 52.0.1 .

I have started Jenkins server through command line java -jar jenkins.war Jenkins server is working fine. But when I tried to execute Jenkins parameterized job (maven test) firefox opens for a moment and closes immediately.

Here is my trace log:

Running TestSuite
Before Test::com.sample.jenkins_demo.LoginTest
1495542214304   geckodriver INFO    Listening on 127.0.0.1:20563
1495542215003   mozprofile::profile INFO    Using profile path C:\Users\X--TM\AppData\Local\Temp\rust_mozprofile.Ec9pWyDHao34
1495542215020   geckodriver::marionette INFO    Starting browser C:\Program Files\Mozilla Firefox\firefox.exe
1495542215057   geckodriver::marionette INFO    Connecting to Marionette on localhost:60423
1495542216346   Marionette  INFO    Listening on port 60423
1495542216787   Marionette  WARN    TLS certificate errors will be ignored for this session
May 23, 2017 5:53:37 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
org.openqa.selenium.InvalidArgumentException: Missing 'type' parameter
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'X-TM', ip: '192.168.139.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_102'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Users\X--TM\AppData\Local\Temp\rust_mozprofile.Ec9pWyDHao34, rotatable=false, timeouts={implicit=0.0, page load=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=true, browserVersion=52.0.1, platformVersion=10.0, moz:processID=10620.0, browserName=firefox, javascriptEnabled=true, platformName=windows_nt}]
Session ID: ec7c23fa-a0b3-4f54-b017-bd192830db16
    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:423)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:150)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:115)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:45)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
    at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteTimeouts.implicitlyWait(RemoteWebDriver.java:868)
    at com.sample.jenkins_demo.Base.setUp(Base.java:129)
    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:498)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:517)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:140)
    at org.testng.TestRunner.beforeRun(TestRunner.java:645)
    at org.testng.TestRunner.run(TestRunner.java:613)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
    at org.testng.SuiteRunner.run(SuiteRunner.java:259)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1199)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1124)
    at org.testng.TestNG.run(TestNG.java:1032)
    at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:295)
    at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84)
    at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:90)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Before Method::com.sample.jenkins_demo.LoginTest

If I use chrome browser it is working fine in Jenkins.

NOTE: Same test is executing locally fine on firefox and chrome browser both.


My firefox configuration:

   public static WebDriver driver = null;
   DesiredCapabilities capabilities = DesiredCapabilities.firefox();
   capabilities.setCapability("marionette", true);
   driver = new FirefoxDriver(capabilities);

   driver.manage().window().maximize();
   driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
   driver.get("https://www.google.co.in");

Can anyone help me to resolve this issue ?

Here is the Answer to your Question:

The error says it all Missing 'type' parameter

It was a known issue on Missing 'type' parameter Build info: version: '3.4.0' on Selenium with Mozilla Firefox. You can find the discussion here .

Upgrading to Mozilla Firefox 53.x will solve your issue.

Let me know if this Answers your Question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM