-1

The RC launches the firefox browser but it tries to open the following link "chrome://src/content/RemoteRunner.html?sessionId=94c0e90deec8470ab358718255d27575&multiWindow=true&baseUrl=https%3A%2F%2Fwww.facebook.com%2F&debugMode=false&driverUrl=http://localhost:4444/selenium-server/driver/"

instead of "https://www.facebook.com/"

import static org.junit.Assert.*;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;

 @SuppressWarnings("deprecation")
public class DemoClass {
     private Selenium selenium;


    @Before
    public void setUp() throws Exception {
        selenium = new DefaultSelenium("localhost", 4444, "*firefox C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe", "https://www.facebook.com/");
        selenium.start();
    }

    @Test
    public void Assignment1() throws Exception {
        selenium.open("/");
        assertTrue(selenium.isElementPresent("id=email"));
        assertTrue(selenium.isElementPresent("id=pass"));
        selenium.type("id=email", "devranipankaj163@gmail.com");
            selenium.type("id=pass", "demo@123");
        assertEquals("devranipankaj163@gmail.com", selenium.getValue("id=email"));
        selenium.click("id=u_0_n");
        selenium.waitForPageToLoad("30000");
     }

    @After
    public void tearDown() throws Exception {
        selenium.stop();
    }
}
Pankaj Devrani
  • 510
  • 1
  • 10
  • 28

1 Answers1

0

Don't use Selenium RC as it is heavily outdated and not maintained anymore.

You should be using Selenium Webdriver with the latest version being 3.1.0 for Java. If you want to run your tests against Firefox you will also need Geckodriver.

Here is a good blog post that explains the setup and other basics of Selenium 3 and Geckodriver.

Robert G
  • 928
  • 7
  • 9