Firefox not launched from Ant and TestNg combination | Selenium Forum
M
Posted on 10/12/2016
Not able to launch Firefox using ANT and TestNG. Getting "java.lang.IncompatibleClassChangeError"
Softwares Version
Eclipse 4.5.0
JDK 1.8.0
JRE 1.8.0
Selenium 2.53.0
TestNG 6.9.9
FireFox 46.0.1

Please help me to resolve this issue.

Using same versions am able to run the code directly from eclipse and working as expected without any issues.
If i run the code from Ant getting above mentioned error.

Complete Error trace :

java.lang.IncompatibleClassChangeError: Class org.openqa.selenium.remote.DesiredCapabilities does not implement the requested
interface org.openqa.selenium.Capabilities
at org.openqa.selenium.firefox.FirefoxDriver.dropCapabilities(FirefoxDriver.java:324)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:217)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at test.NewTest.Browser(NewTest.java:10)
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:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:774)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1048)
at org.testng.TestNG.privateMain(TestNG.java:1355)
at org.testng.TestNG.main(TestNG.java:1324)

M
Replied on 11/12/2016

Are you using grid as well
?
DesiredCapabilities ?


M
Replied on 12/12/2016

Please find the code below which i am running from Ant :

@Test
public void Browser() {
FirefoxDriver driver=new FirefoxDriver();
driver.get("http://flipkart.com");
driver.quit();

}

I am trying to launch browser and generating XSLT reports for the same.


M
Replied on 13/12/2016

Please help me to resolve the above mentioned issue.


M
Replied on 13/12/2016

Which version of firefox and selenium are you using
I am sure you havnt kept all jars of selenium under class path


M
Replied on 14/12/2016

Sir,

I am using Selenium 2.53.0 and Firefox version is 46.0.1.

For to be on safer side i have added all the jars to my project which is provided by you. (\\Selenium_Pack_Nov\jars).

Now am getting following error :

[color=#FF4080:v84mhcaq]org.openqa.selenium.WebDriverException: org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within
45000 ms[/color:v84mhcaq]
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_111'
Driver info: driver.version: firefox
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_111'
Driver info: driver.version: firefox
at org.openqa.selenium.firefox.internal.ExtensionConnectionFactory.connectTo(ExtensionConnectionFactory.java:46)
at org.openqa.selenium.firefox.FirefoxDriver.connectTo(FirefoxDriver.java:139)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:129)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:109)
at test.NewTest.Browser(NewTest.java:10)
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.Met


M
Replied on 15/12/2016

Any suggestions to resolve the error
[color=#BF0000:24ygfgea]"org.openqa.selenium.WebDriverException: org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within 45000 ms"[/color:24ygfgea]


M
Replied on 18/12/2016

reduce to version FF43


M
Replied on 20/12/2016

Reduced to FF 43.. Still same issue am facing.

Please guide me sir.

How to sync Selenium, TestNg,Eclipse, JDK and Browser versions all together .Really confusing Responsive image


M
Replied on 21/12/2016

just hit and try selenium with different versions of firefox.

every selenium version only works with few specific versions of firefox. to find these versions you hit and try a different version.


[quote:16s6h8s2]How to sync Selenium, TestNg,Eclipse, JDK and Browser versions all together .Really confusing Responsive image
[/quote:16s6h8s2]
let's not get ahead of ourselves.


M
Replied on 26/03/2017

Hi,
I am also facing same issue-Not able to launch Firefox using ANT and TestNG. Getting "java.lang.IncompatibleClassChangeError" in my code.
Were you able to identify the cause? Could you please let me know the solution.

Thanks in Advance.


M
Replied on 27/03/2017

are you able to launch using testng.xml.


M
Replied on 27/03/2017

Yes Its all working fine with TestNG.xml


M
Replied on 27/03/2017

send a screen shot of the exception.


M
Replied on 30/03/2017

Trying this code

public class launchfirefox {

@Test
public void launchMozilla(){

System.setProperty("webdriver.gecko.driver","C:/Tools/TestingTools/selenium/geckodriver.exe");
WebDriver driver=new FirefoxDriver();
driver.get("http://gmail.com");
}

}

firefox version 52.0.2
Selenium version 3.0.1

Attached are the screenshot of the report and cmd prompt.
Please let me know if any other details required.

Thanks

Responsive image

M
Replied on 30/03/2017

can you come on skype?