0
votes

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

1
Yes there is, you should see this question posted : HereRobert Reynolds
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
It seems a plugin issue that you installed in the firefox browser. go through all the plugins installed. support.mozilla.org/en-US/questions/1006356. uninstall or update the plugin which is causing the problem.Naveen Kumar R B
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
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 methodNaveen Kumar R B

1 Answers

1
votes

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.