0

Latest mozilla version not supported in selenium, Is there any solution?

here is my code

package Admin_Package;

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

public class test {



public static void main(String[] args) throws InterruptedException {
    // Download "geckodriver.exe" from https://github.com/mozilla/geckodriver/releases
    System.setProperty("webdriver.gecko.driver","D:\\ecl_ee\\jar_files\\gecko_driver\\geckodriver.exe");
    WebDriver driver = new FirefoxDriver();

    driver.get("http://www.facebook.com");

    System.out.println("Application title is ============="+driver.getTitle());

    driver.quit();
} }

If I am using 3.0.1 standalone below mention error is coming java.lang.IllegalStateException: The driver executable does not exist: D:\ecl_ee\jar_files\gecko_driver\geckodriver.exe at com.google.common.base.Preconditions.checkState(Preconditions.java:199) at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:121) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:116) at org.openqa.selenium.firefox.GeckoDriverService.access$000(GeckoDriverService.java:37) at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:95) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296) 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:135) at Admin_Package.test.before(test.java:20) 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 org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86) at org.testng.internal.Invoker.invokeMethod(Invoker.java:646) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:823) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112) at org.testng.TestRunner.privateRun(TestRunner.java:778) at org.testng.TestRunner.run(TestRunner.java:632) at org.testng.SuiteRunner.runTest(SuiteRunner.java:366) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319) at org.testng.SuiteRunner.run(SuiteRunner.java:268) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1225) at org.testng.TestNG.runSuites(TestNG.java:1075) at org.testng.TestNG.run(TestNG.java:1047) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:137) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:58)

Browser opened, then after this error is getting

1478585217132 geckodriver INFO    Listening on 127.0.0.1:42466
Nov 08, 2016 11:36:57 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
1478585217594 mozprofile::profile INFO    Using profile path C:\Users\Divya\AppData\Local\Temp\rust_mozprofile.Xge4QjcxXLSu
1478585217596 geckodriver::marionette INFO    Starting browser C:\Program Files\Mozilla Firefox\firefox.exe
1478585217605 geckodriver::marionette INFO    Connecting to Marionette on localhost:2185
1478585219168 Marionette  INFO    Listening on port 2185
1478585221536 Marionette  INFO    startBrowser 2a9015b9-cac1-4641-839d-8f9279055519
Nov 08, 2016 11:37:01 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
JavaScript warning: http://reventics.infoversity.in/app/services/sharedProperties.js, line 13: unreachable code after return statement
JavaScript warning: http://reventics.infoversity.in/app/services/sharedProperties.js, line 13: unreachable code after return statement
Application title is =============Reventics
[Child 1708] ###!!! ABORT: Aborting on channel error.: file c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/glue/MessageChannel.cpp, line 2052
Nov 08, 2016 11:37:09 AM org.openqa.selenium.os.UnixProcess destroy
SEVERE: Unable to kill process with PID 6120

enter image description here

Before, After suite class

package Admin_Package;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeSuite;
public class BA_Admin {
public static WebDriver driver;
@BeforeSuite
public void beforeSuite() throws InterruptedException {           
System.setProperty("webdriver.gecko.driver","D:\\ecl_ee\\jar_files\\gecko_driver\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("URL");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().window().maximize();
}
@AfterSuite     
public void afterSuite() throws Exception { 
driver.quit();
}
}

Extended class

package Admin_Package;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class Role_Add extends Admin_Package.BA_Admin{
@BeforeTest
public void login() throws InterruptedException {
driver.findElement(By.xpath(".//*[@id='txtUsername']")).sendKeys("venkatm");
Thread.sleep(5000);
driver.findElement(By.xpath(".//*[@id='txtPassword']")).sendKeys("Password@123");
Thread.sleep(5000);
driver.findElement(By.xpath("html/body/div[2]/div/form/div/div/div[2]/div/button[1]")).click();
Thread.sleep(5000);
System.out.println("Login Test Case Passed"); 
} 
@Test
public void link1() throws InterruptedException { 
driver.findElement(By.xpath("html/body/div[1]/aside/section/ul[1]/li[1]")).click();
Thread.sleep(5000);
}  
}
}

After run this class below error is coming

1478588994124 geckodriver INFO    Listening on 127.0.0.1:36811
Nov 08, 2016 12:39:54 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
1478588994625 mozprofile::profile INFO    Using profile path C:\Users\Divya\AppData\Local\Temp\rust_mozprofile.9LNcRBy7LvnX
1478588994628 geckodriver::marionette INFO    Starting browser C:\Program Files\Mozilla Firefox\firefox.exe
1478588994637 geckodriver::marionette INFO    Connecting to Marionette on localhost:3453
1478588996301 Marionette  INFO    Listening on port 3453
1478588998908 Marionette  INFO    startBrowser 533a5574-8667-4d6a-8455-b78be6709d83
Nov 08, 2016 12:39:59 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
JavaScript warning: http://reventics.infoversity.in/app/services/sharedProperties.js, line 13: unreachable code after return statement
JavaScript warning: http://reventics.infoversity.in/app/services/sharedProperties.js, line 13: unreachable code after return statement
[Utils] Attempting to create D:\ecl_ee\Projects\Reventics\test-output\Default suite\Default test.html
[Utils]   Directory D:\ecl_ee\Projects\Reventics\test-output\Default suite exists: true
[Utils] Attempting to create D:\ecl_ee\Projects\Reventics\test-output\Default suite\Default test.xml
[Utils]   Directory D:\ecl_ee\Projects\Reventics\test-output\Default suite exists: true
FAILED CONFIGURATION: @BeforeTest login
java.lang.NullPointerException
at Admin_Package.Role_Add.login(Role_Add.java:18)
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 org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:216)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:143)
at org.testng.TestRunner.beforeRun(TestRunner.java:656)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1225)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1150)
at org.testng.TestNG.runSuites(TestNG.java:1075)
at org.testng.TestNG.run(TestNG.java:1047)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:137)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:58)

SKIPPED CONFIGURATION: @AfterTest Create_Role
SKIPPED: link1

Thanks,

Divya

Divya
  • 69
  • 2
  • 11
  • 2
    Yes there is, you should see this question posted : [Here](http://stackoverflow.com/questions/37785686/how-to-use-the-gecko-executable-with-selenium) – Omegaspard Nov 07 '16 at 10:04
  • @ Bob Reynolds I am using your referring code but, getting same issue browser not supported – Divya Nov 07 '16 at 10:52
  • Maybe could you give a trace of your code ? – Omegaspard Nov 07 '16 at 10:58
  • @ Bob Reynolds I am sending my code please once check – Divya Nov 07 '16 at 11:03
  • did you try with the latest selenium jars? 3.0.1? or still trying with 2.50? – Naveen Kumar R B Nov 07 '16 at 11:46
  • @Naveen I am using 2.53 – Divya Nov 07 '16 at 11:49
  • upgrade to 3.0.1 and try. I don't think so 2.53 have support for geckodriver. From Firefox 48 onwards, you have to use geckodriver. https://github.com/mozilla/geckodriver – Naveen Kumar R B Nov 07 '16 at 12:10
  • @Naveen I am updating 3.0.1 jar but, getting error (above mentioned please check) – Divya Nov 07 '16 at 12:14
  • 1
    the error says "The driver executable does not exist: D:\ecl_ee\jar_files\gecko_driver\geckodriver.exe". did you really keep the geckodriver.exe in the said location? – Naveen Kumar R B Nov 07 '16 at 12:16
  • Agree with naveen, this clearly is a "File not found" issue! nothing to do with browser support I guess! Is this solved? @Divya – Waman Nov 08 '16 at 05:35
  • @Naveen & Wama U R right I am getting wrong path, It's modifying, but I am getting another error above is mentioned please tell me the solution (browser opened and get the URL, then this error is coming ) – Divya Nov 08 '16 at 06:18
  • 1
    It seems a plugin issue that you installed in the firefox browser. go through all the plugins installed. https://support.mozilla.org/en-US/questions/1006356. uninstall or update the plugin which is causing the problem. – Naveen Kumar R B Nov 08 '16 at 06:25
  • @Naveen I am using extended class but it's failed above is mentioned code please once check – Divya Nov 08 '16 at 07:23
  • 1
    I did not understand the problem. not much aware of the framework. from the trace, I got to know that NullPointerException is raised "FAILED CONFIGURATION: @BeforeTest login java.lang.NullPointerException at Admin_Package.Role_Add.login(Role_Add.java:18)". check what is the reason for the exception. is it because the class run before some other class? or in the login method, element is not found? not so sure. – Naveen Kumar R B Nov 08 '16 at 07:34
  • @Naveen above mentioned in my code please once check. The same code executed in 45.0.1 firefox version – Divya Nov 08 '16 at 08:21
  • 1
    Though I am not sure why NullPointerExcpetion is thorwn, I suggest check the folllowing things. 1. whether driver object is NOT null? 2. whether username field is NOT found? 3. whether Password field is NOT found? just use print statement as follows. 1. sysout driver 2. sysout driver.findElement(By.xpath(".//*[@id='txtUsername']")) 3. sysout driver.findElement(By.xpath(".//*[@id='txtPassword']")) and see whether are retuning NullPointer or the objects. same applies to all the elmeents in the login method – Naveen Kumar R B Nov 08 '16 at 08:30
  • I doubt the following XPATH "driver.findElement(By.xpath("html/body/div[2]/div/form/div/div/div[2]/div/button[1]")).click();" please recheck in the browser using Firebug plugin where it matches to any element or not? – Naveen Kumar R B Nov 08 '16 at 08:30
  • @Naveen All paths are in site, and I am using single class it's working, but when using extended class it's fail – Divya Nov 08 '16 at 10:17
  • 1
    in the following line "WebDriver driver = new FirefoxDriver();" remove WebDriver reference and try. It seems like you are creating a local variable which is causing all the problems (and you are referencing global driver object which is never initialized). – Naveen Kumar R B Nov 08 '16 at 12:41
  • 1
    @Naveen it's working Thanq so much!!! – Divya Nov 09 '16 at 07:13
  • 1
    I am glad to hear that – Naveen Kumar R B Nov 09 '16 at 08:56

1 Answers1

1

creating a local variable is causing all the troubles.

WebDriver driver = new FirefoxDriver();

remove WebDriver reference in the object creation, so the reference will be added to the global driver object so that Child classes can refer.

Naveen Kumar R B
  • 6,248
  • 5
  • 32
  • 65