Слайд 2Gradle settings
buildscript {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
allprojects {

repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
Слайд 3Gradle settings
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
// https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java

compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '2.53.1'
// https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver
compile group: 'org.seleniumhq.selenium', name: 'selenium-chrome-driver', version: '3.3.1'
}
Слайд 4Gradle Settings
test {
testLogging {
// Make sure output from
// standard

out or error is shown
// in Gradle output.
showStandardStreams = true
}
}
tasks.withType(Test) {
testLogging {
events 'started', 'passed'
}
}
Слайд 5jUnit Annotation
@BeforeClass
public static void createAndStartService() throws IOException {
service = new ChromeDriverService.Builder()

.usingDriverExecutable(new File("\\chromedriver.exe"))
.usingAnyFreePort()
.build();
service.start();
}
Слайд 6jUnit Annotation
@Before
public void setUp() throws Exception {
driver = new ChromeDriver(service);
driver.manage().timeouts().implicitlyWait(90,

TimeUnit.SECONDS);
driver.manage().window().maximize();
}
Слайд 7jUnit Annotation
@Test
public void openGoogle() throws Exception {
driver.get("http://google.com.ua");
driver.findElement(By.id("id")).click();
driver.findElement(By.xpath(".//*[@id='root']/form/input[2]")).sendKeys("dadkhb");
}
![jUnit Annotation @Test public void openGoogle() throws Exception { driver.get("http://google.com.ua"); driver.findElement(By.id("id")).click(); driver.findElement(By.xpath(".//*[@id='root']/form/input[2]")).sendKeys("dadkhb"); }](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/1011217/slide-6.jpg)
Слайд 8jUnit Annotation
@After
public void closeDriver() throws Exception{
driver.close();
}
