-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgooglesearch.java
36 lines (33 loc) · 1.54 KB
/
googlesearch.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package org.agueddidi.selenium.GoogleSearch;
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;
public class GoogleSearch {
public static void main(String[] args) throws Exception {
System.out.println(" Test Start ");
//not yet complet try to use this https://github.com/Ardesco/Selenium-Maven-Template/blob/master/pom.xml
//to do ===> http://www.software-testing-tutorials-automation.com/2015/04/data-driven-test-using-csv-file-in.html
System.setProperty("webdriver.gecko.driver", "/mnt/geckodriver11");
//local gecko path (linux path)
FirefoxDriver FF = new FirefoxDriver();
GoogleSearch.runURL(FF);
//local chrome webdrive path
System.setProperty("webdriver.chrome.driver", "/mnt/chromedriver");
ChromeDriver Chr = new ChromeDriver();
GoogleSearch.runURL(Chr);
System.out.println("End of run");
}
//Test instructions
private static void runURL(WebDriver rwd) {
rwd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
rwd.get("https://www.google.tn/?gws_rd=cr&ei=BLFqWNv1OMiVaMX2i8gE");
rwd.findElement(By.id("lst-ib")).click();
rwd.findElement(By.id("lst-ib")).clear();
rwd.findElement(By.id("lst-ib")).sendKeys("Selenuim Samples");
rwd.findElement(By.id("lst-ib")).click();
rwd.findElement(By.id("lst-ib")).sendKeys("\n");
rwd.quit();
}
}