1

I am unable to launch Firefox browser(53) using selenium webdriver (3.11) The code works well with Chromedriver but gives exception with Firefox.

import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class CNN { public static void main(String[] args) { WebDriver driver = new ChromeDriver(); driver.get("http://www.cnn.com"); String text =driver.findElement(By.xpath("//*[@id='intl_homepage1-zone-1']/div[2]/div/div[1]/ul/li[1]/article/a/h2")).getText(); System.out.println(text); } } 

This is the exception that i am getting:-

 Exception in thread "main" org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:5542 Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:08.638Z' 

1 Answer 1

1

Do you download and install gecko driver for Firefox? If not please do it and use as system properties while running test in Firefox.

Sign up to request clarification or add additional context in comments.

3 Comments

It worked! not only for this class but also the other classes where firefox was not working. Thanks
You need to create CapabilitiesGenerator for the current version of WebDriver and read more about WebDriverFactory Pattern.
how to create capabilitesgenerator, where can i find webdriverfactory pattern information

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.