6
6
import org .openqa .selenium .support .ui .WebDriverWait ;
7
7
import org .testng .annotations .Test ;
8
8
9
- public class GoogleIT {
9
+ public class CoverosIT {
10
10
11
11
@ Test
12
- public void cheeseSearch () {
12
+ public void seleniumSearch () {
13
13
//for linux/mac installations
14
14
// System.setProperty("webdriver.gecko.driver", "lib/geckodriver");
15
15
//for windows installations
@@ -20,33 +20,34 @@ public void cheeseSearch() {
20
20
WebDriver driver = new FirefoxDriver ();
21
21
22
22
// And now use this to visit Google
23
- driver .get ("http ://www.google .com" );
23
+ driver .get ("https ://www.coveros .com" );
24
24
// Alternatively the same thing can be done like this
25
- // driver.navigate().to("http ://www.google .com");
25
+ // driver.navigate().to("https ://www.coveros .com");
26
26
27
27
// Find the text input element by its name
28
- WebElement element = driver .findElement (By .name ( "q " ));
28
+ WebElement element = driver .findElement (By .id ( "s " ));
29
29
30
30
// Enter something to search for
31
- element .sendKeys ("Cheese! " );
31
+ element .sendKeys ("selenium " );
32
32
33
33
// Now submit the form. WebDriver will find the form for us from the element
34
34
element .submit ();
35
35
36
36
// Check the title of the page
37
37
System .out .println ("Page title is: " + driver .getTitle ());
38
38
39
- // Google 's search is rendered dynamically with JavaScript.
39
+ // Coveros 's search is rendered dynamically with JavaScript.
40
40
// Wait for the page to load, timeout after 10 seconds
41
41
(new WebDriverWait (driver , 10 )).until (new ExpectedCondition <Boolean >() {
42
42
public Boolean apply (WebDriver d ) {
43
- return d .getTitle ().toLowerCase (). startsWith ("cheese! " );
43
+ return d .getTitle ().startsWith ("You searched for " );
44
44
}
45
45
});
46
46
47
47
// Should see: "cheese! - Google Search"
48
48
System .out .println ("Page title is: " + driver .getTitle ());
49
49
50
+
50
51
//Close the browser
51
52
driver .quit ();
52
53
}
0 commit comments