Skip to content

Instantly share code, notes, and snippets.

@safrrhmn
Created March 13, 2015 02:30
Show Gist options
  • Save safrrhmn/b614f6eb7ab92b1b282f to your computer and use it in GitHub Desktop.
Save safrrhmn/b614f6eb7ab92b1b282f to your computer and use it in GitHub Desktop.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.*;
/**
* Created by Saifur on 2/14/2015.
*/
public class HelloSelenium {
WebDriver driver;
String url = "https://github.com/";
@BeforeClass
public void SertUpTest(){
System.setProperty("webdriver.chrome.driver", "\\working\\Seleniumjava\\drivers\\chromedriver.exe");
//System.setProperty("webdriver.ie.driver", "\\working\\Seleniumjava\\drivers\\IEDriverServer.exe");
driver = new ChromeDriver();
//driver = new FirefoxDriver();
//driver = new InternetExplorerDriver();
driver.navigate().to(url);
driver.manage().window().maximize();
}
@AfterClass
public void CleaUpDriver(){
driver.quit();
}
}
import org.openqa.selenium.By;
import org.testng.Assert;
import org.testng.annotations.Test;
/**
* Created by Saifur on 3/12/2015.
*/
public class TestClass1 extends HelloSelenium {
@Test
public void DemoTest() throws InterruptedException {
driver.findElement(By.cssSelector(".js-site-search-form>input")).sendKeys("TestClass1");
}
}
import org.openqa.selenium.By;
import org.testng.annotations.Test;
/**
* Created by Saifur on 3/12/2015.
*/
public class TestClass2 extends HelloSelenium {
@Test
public void DemoTest() throws InterruptedException {
driver.findElement(By.cssSelector(".js-site-search-form>input")).sendKeys("TestClass2");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment