package visGrid;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
public class Sample1 {
public WebDriver driver;
@Parameters({"browser"}) //this is to indicate that browser value is read from testng.xml file
@BeforeClass
public void beforeClass(String browser) throws MalformedURLException{
DesiredCapabilities capability= new DesiredCapabilities();
capability.setBrowserName(browser);
System.out.println(browser);
driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),capability);
}
@Test
public void search() throws Exception {
driver.get("http://www.bing.com");
driver.findElement(By.id("sb_form_q")).sendKeys("grid testing");
}
@AfterClass
public void afterClass(){
driver.quit();
}
}