0

i am creating my first test script using selenium web driver with java eclipse,each time I execute the below code,the firefix is opened and then stop working

       package Newpackage;
      import org.openqa.selenium.WebDriver;
     import org.openqa.selenium.firefox.FirefoxDriver;

     public class AmrClass {
       public static void main(String[] args) {
        // declaration and instantiation of objects/variables
        try {
                WebDriver driver = new FirefoxDriver();

  //declaration of varaibles of type string
               String baseUrl = "http://newtours.demoaut.com";
               String expectedTitle = "Welcome: Mercury Tours";
            String actualTitle = "";
            //the get method will contain the baseurl varaible value
            driver.get(baseUrl);

            // get the actual value of the title
            actualTitle = driver.getTitle();
            if (actualTitle.contentEquals(expectedTitle)){
                System.out.println("Test Passed!");
            } else {
                System.out.println("Test Failed");
            }

            //close Firefox
            driver.close();

            // exit the program explicitly
            System.exit(0);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }`

And I am getting the below error:

  Could not start a new session. Possible causes are invalid address of the  
   remote server or browser start-up failure.
Amr Hassan
  • 21
  • 1
  • 1
  • 7
  • What is the version of firefox you are using? – RemcoW Jun 16 '16 at 11:41
  • you should follow this link.. http://stackoverflow.com/questions/37836121/unable-to-open-browser-with-specified-url-using-selenium-webdriver – Saurabh Gaur Jun 16 '16 at 11:46
  • Possible duplicate of [Can't open browser with selenium after firefox update](http://stackoverflow.com/questions/37761668/cant-open-browser-with-selenium-after-firefox-update) – Mobrockers Jun 16 '16 at 13:05

0 Answers0