0

Is selenium-server-standalone-3.0.1.jar compatible with Windows 10 OS ?

I am able to run a simple java program, getting below error on launching Firefox browser. Tried using TestNG, but facing same issue

Code :

package com.riversad.violet;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class DemoTests {
    public void sampleTest1(){
        System.setProperty("webdriver.gecko.driver", "D:\\Auto Violet Work Space\\VioletAutomation\\lib\\geckodriver.exe");
        WebDriver driver = new FirefoxDriver();
        driver.get("http://www.gmail.com");
    }
    public void tests() {
        System.out.println("hellow world");
    }
    public static void main(String[] args) {
        DemoTests dt=new DemoTests();
        dt.sampleTest1();
        dt.tests();
    }
}

Error :

Exception in thread "main" java.lang.NoSuchFieldError: INSTANCE at org.apache.http.conn.ssl.SSLConnectionSocketFactory.(SSLConnectionSocketFactory.java:144) at org.openqa.selenium.remote.internal.HttpClientFactory.getClientConnectionManager(HttpClientFactory.java:71) at org.openqa.selenium.remote.internal.HttpClientFactory.(HttpClientFactory.java:57) at org.openqa.selenium.remote.internal.HttpClientFactory.(HttpClientFactory.java:60) at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.getDefaultHttpClientFactory(ApacheHttpClient.java:250) at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.(ApacheHttpClient.java:227) at org.openqa.selenium.remote.HttpCommandExecutor.getDefaultClientFactory(HttpCommandExecutor.java:92) at org.openqa.selenium.remote.HttpCommandExecutor.(HttpCommandExecutor.java:71) at org.openqa.selenium.remote.HttpCommandExecutor.(HttpCommandExecutor.java:59) at org.openqa.selenium.remote.service.DriverCommandExecutor.(DriverCommandExecutor.java:49) at org.openqa.selenium.firefox.FirefoxDriver.createCommandExecutor(FirefoxDriver.java:277) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:247) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:242) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:238) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:127) at com.riversad.violet.DemoTests.sampleTest1(DemoTests.java:25) at com.riversad.violet.DemoTests.main(DemoTests.java:41)

jignesh Vadadoriya
  • 3,244
  • 3
  • 18
  • 29
  • 1. Yes windows 10 support selenium 3.0.1 2. From what I can see from your code you use only WebDriver API so you do not need selenium-server - http://docs.seleniumhq.org/docs/03_webdriver.jsp 3. show us exception from code that you pasted here because now we cannot see which lines of code cause exception – mackowski Dec 14 '16 at 12:43
  • Exception is caught in "WebDriver driver = new FirefoxDriver();" – user3376050 Dec 15 '16 at 06:02
  • What do you use for building your project? Maven? Gradle?java.lang.NoSuchFieldError is often throw some dependency is included more then one time in different versions. See for reference: http://stackoverflow.com/questions/22330848/httpclient-example-exception-in-thread-main-java-lang-nosuchfielderror-inst or http://stackoverflow.com/questions/27921077/nosuchfielderror-instance-at-org-apache-http-impl-io-defaulthttprequestwriterfac. – mackowski Dec 15 '16 at 07:53
  • I am not using Maven or Gradle. I just go to Project-->Clean. Hope this will build my project. And i am using the latest firefox and chrome version with Selenium 3.0.1 jar file – user3376050 Dec 15 '16 at 11:31
  • Do you use any other external libraries? – mackowski Dec 15 '16 at 11:35
  • Yes, what are the libraries that i should have? I have used 1.selenium-java-3.0.1.jar 2.selenium-server-3.0.1.jar 3.selenium-server-standalone-3.0.1.jar 4.testng-6.9.9.jar – user3376050 Dec 15 '16 at 11:57
  • First of all you do not need selenium-servers jars (I told about it in first comment) Does your code work on selenium 2? Did you try use different browser than firefox? – mackowski Dec 15 '16 at 12:13

1 Answers1

0

I have faced similar issue while using webdriver with selenium 3.0.1 on my Windows 10 machine.

Download older version selenium webdriver from [Selenium Downlaod][1]. Search for jcommander-1.48.jar from the downloaded zip file and add this jar into your current project.

This should fix the NoSuchFieldError and your project should compile successfully.

Saurav
  • 96
  • 1
  • 5