Open Browser and Check for element..BETTER !!
import javax.swing.JOptionPane;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Sample1
{
public static void main(String[] args) throws InterruptedException
{
System.setProperty("webdriver.firefox.bin","E://Work//Program_files//Firefox17.0//firefox.exe");
FirefoxDriver oDriver=new FirefoxDriver();
oDriver.get("http://yahoo.com");
if (oDriver.findElementByXPath("//*[@id='default-u_14119506-bd']/div/h1/span").isDisplayed()==true)
{
System.out.println("passed");
}
else
{
System.out.println("failed");
}
// String a=JOptionPane.showInputDialog(null,"What is your name ?");
Thread.sleep(5000);
oDriver.close();
oDriver.quit();
JOptionPane.showMessageDialog(null,"Done");
}
}
No comments:
Post a Comment