I m pretty new to both Java and Selenium, and i was trying a program to get Firefox up and running using a Webdriver. Here's the code i used
package testPackage1;
import java.util.List;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.*;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
public class FirefoxAutomationTest {
public static void main(String[] args){
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
}
}
All this does is open and close the firefox window, it does not load google, and it throws a UnreachableBrowserException. However when i used HtmlUnitDriver instead of FirefoxDriver, everything seems to be working fine. Am I doing something wrong here, or is this a common issue with Selenium? How do i fix this?
EDIT: List of dependencies i have added:
- selenium-api-2.35.0.jar
- selenium-java-2.35.0.jar
- selenium-server-2.35.0.jar
- selenium-server-standalone-2.35.0.jar
- selenium-firefox-driver-2.35.0.jar
UPDATE: Been trying a lot of things to get this working, and it seems i can open html pages which are saved on my hard disk, but the browser quits itself even if i m not explicitly specifying driver.close() or driver.quit(). Nothing is shown on the console, so i guess i am safe to assume that it doesn't throw any error. Also, I guess the webDriver produces a webpage with the following info before quitting:
XML Parsing Error: undefined entity
Location: chrome://browser/content/browser.xul
Line Number 36, Column 1:<window id="main-window"
^
Now i tried the url shown on the above, and it leads to some part of the firefox interface. What's going on?