package pack2;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class sample_class {
public static void main(String[] args) {
//==========Sample code to execute on Firefox browser=============
FirefoxDriver d = new FirefoxDriver();
d.get("www.google.com");
d.manage().window().maximize();
d.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
d.findElement(By.name("q")).sendKeys("Testing Masters Technologies");
d.findElement(By.name("btnG")).click();
d.quit();
//===========Sample code to execute on Chrome browser=============
System.setProperty("webdriver.chrome.driver", "d:\\ChromeDriver.exe");
WebDriver d = new ChromeDriver();
d.get("www.google.com");
d.manage().window().maximize();
d.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
d.findElement(By.name("q")).sendKeys("Testing Masters Technologies");
d.findElement(By.name("btnG")).click();
d.quit();
//===========Sample code to execute on IE browser=================
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability (InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
System.setProperty("webdriver.ie.driver", "d:\\IEDriverServer.exe");
WebDriver d = new InternetExplorerDriver();
d.get("www.google.com");
d.manage().window().maximize();
d.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
d.findElement(By.name("q")).sendKeys("Testing Masters Technologies");
d.findElement(By.name("btnG")).click();
d.quit();
}
}
No comments:
Post a Comment