0

I'm trying to integrate Jenkins with Selenium. When I do the execution in Eclipse, Its opening an Firefox instance and test suite is working as expected.

Below is my sample test file:

public class testFacebook {

    @Test
    public void TestFireFox(){


    WebDriver driver=new FirefoxDriver();

    driver.manage().window().maximize();

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

    driver.quit();

    }

}

This is working good in windows 7 (eclipse build), as I have firefox installed in my system.

But I need the same to be tested in Jenkins running on AWS ec2 instance (Linux AMI), When I create a build for the same above code in Jenkins, Below is the error I see.

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.52 sec <<< FAILURE! - in TestSuite
TestFireFox(com.selenium.SeleniumTesting)  Time elapsed: 0.141 sec  <<< FAILURE!
org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: LINUX
Build info: version: '2.47.1', revision: 'unknown', time: '2015-07-30 11:02:44'
System info: host: 'ip-172-31-18-42', ip: '172.31.18.42', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.35-33.55.amzn1.x86_64', java.version: '1.8.0_112'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.firefox.internal.Executable.<init>(Executable.java:74)
    at org.openqa.selenium.firefox.FirefoxBinary.<init>(FirefoxBinary.java:60)
    at org.openqa.selenium.firefox.FirefoxBinary.<init>(FirefoxBinary.java:56)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
    at com.selenium.SeleniumTesting.TestFireFox(SeleniumTesting.java:12)


Results :

Failed tests: 
  SeleniumTesting.TestFireFox:12 » WebDriver Cannot find firefox binary in PATH....

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

I have installed Selenium plugin in Jenkins. Please let me what are the changes I have to do in Test file as well as things related to Firefox installation.

Thanks in advance.

1 Answers1

0
  1. add the path to the firefox binary to your path variable

or,

  1. Do this: System.setProperty("webdriver.firefox.bin", "C:\Users\xxx\AppData\Local\Mozilla Firefox\firefox.exe");

    [ This example is for windows]

Sandeep Vaidya
  • 113
  • 1
  • 13