I have a simple automation script written in selenium webdriver. I need to execute this script through Jenkins. So I've configured the job in Jenkins and when tried to execute, I'm unable to open Firefox browser.
The console output is as follows:
Running TestSuite
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: cannot open display: :99
Failed tests:
NewTest.testEasy:25 » WebDriver Failed to connect to binary FirefoxBinary(/usr...
This is my code:
@Test
public void testEasy() {
// WebDriver driver = new FirefoxDriver();
WebDriver driver = null;
FirefoxBinary binary = new FirefoxBinary(new File("/usr/bin/firefox"));
binary.setEnvironmentProperty("DISPLAY",System.getProperty("lmportal.xvfb.id",":99"));
driver = new FirefoxDriver(binary,null);
driver.get("https://www.google.co.in/?gfe_rd=cr&ei=drM-V8PiHPPI8AevjriQDA&gws_rd=ssl");
// String title = driver.getTitle();
// AssertJUnit.assertTrue(title.contains("Free Selenium Tutorials"));
// System.out.println("TEST");
}