Always thought selenium was magic , too dificult to start .... but it is a 2 hour learning which make you to start you automation:
The best thing to start Selenium is read first the following 10 minute article.
http://epyramid.wordpress.com/2008/11/26/setting-up-selenium-rc-testng-using-eclipse/
Also Install selenium IDE plug in for Mozilla. (5 minute)
For installing Selenium First read
http://seleniumhq.org/docs/05_selenium_rc.html
you can download IDE and RC from here In installation section (20 Minute)
http://seleniumhq.org/download/
First Script:
import com.thoughtworks.selenium.*;
import org.testng.annotations.*;
import static org.testng.Assert.*;
public class GoogleTest1
{
public Selenium selenium;
@BeforeClass
public void setup()
{
selenium = new DefaultSelenium("localhost", 4444, "*iexplore","http://www.google.com");
selenium.start();
}
@Test
public void Googlesearch()
{
selenium.open("http://www.Google.com/webhp");
assertEquals("Google", selenium.getTitle());
selenium.type("q", "Selenium OpenQA");
assertEquals("Selenium OpenQA", selenium.getValue("q"));
selenium.click("btnG");
selenium.waitForPageToLoad("50000");
}
@AfterClass
public void StopTest()
{
selenium.stop();
}
}
No comments:
Post a Comment