Please find Selenium example Walkthru. (Win 7- 64 bit)
3. Run Command Prompt in administrator mode.
Start Selenium Server. Command is - java -jar selenium-server.jar. To Run in Single Window, you need to specify
java -jar selenium-server.jar -singleWindow
4. Second very good walkthrough is available in
http://epyramid.wordpress.com/2008/11/26/setting-up-selenium-rc-testng-using-eclipse/. This link does not seem to exist now, You need to download Eclipse IDE for Java Developers. (Check Links -
Link1)
5. Run Eclipse program as Administrator
6. Got Error ‘Failed to start new browser session: java.lang.RuntimeException: Firefox 3 could not be found in the path! Please add the directory containing firefox.exe to your PATH environment’
7. Fix is below line of code
selenium = new DefaultSelenium("localhost", 4444, "*firefox C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe",http://yahoo.com/);
8. Modified code as per example in below page -
http://seleniumhq.org/docs/05_selenium_rc.html
9. Code Example
import com.thoughtworks.selenium.*;
import org.testng.annotations.*;
import static org.testng.Assert.*;
public class GoogleTest
{
public Selenium selenium;
public void setup()
{
selenium = new DefaultSelenium("localhost", 4444, "*firefox C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe","http://google.com");
selenium.start();
}
public void search()
{
selenium.open("http://www.Google.com/");
selenium.type("q", "selenium rc");
selenium.click("btnG");
selenium.waitForPageToLoad("30000");
assertTrue(selenium.isTextPresent("seleniumhq.org"));
}
public static void main(String arg[])
{
GoogleTest g = new GoogleTest();
g.setup();
g.search();
}
}
Snapshot of Example