-
Notifications
You must be signed in to change notification settings - Fork 188
/
Util.java
68 lines (55 loc) · 1.73 KB
/
Util.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package com.evolveum.midpoint.testing.selenide.tests;
import com.codeborne.selenide.SelenideElement;
import org.openqa.selenium.By;
import org.springframework.stereotype.Component;
import org.testng.annotations.Test;
import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.close;
import static com.codeborne.selenide.Selenide.open;
/**
* Created by Kate on 13.08.2015.
*/
@Component
public class Util {
private String siteUrl;
private String adminUserLogin;
private String adminUserPassword;
/**
*close browser window
*/
@Test
public void closeTest(){
close();
}
/**
* Looks for the element with specified searchText
* and returns the first element from the search results
* @param searchText
* @return
*/
public void searchForElement(String searchText, String searchButtonXpath){
//search for element in search form
$(By.name("basicSearch:searchText")).shouldBe(visible).setValue(searchText);
$(By.xpath(searchButtonXpath)).shouldHave(text("Search")).click();
}
public String getSiteUrl() {
return siteUrl;
}
public void setSiteUrl(String siteUrl) {
this.siteUrl = siteUrl;
}
public String getAdminUserLogin() {
return adminUserLogin;
}
public void setAdminUserLogin(String adminUserLogin) {
this.adminUserLogin = adminUserLogin;
}
public String getAdminUserPassword() {
return adminUserPassword;
}
public void setAdminUserPassword(String adminUserPassword) {
this.adminUserPassword = adminUserPassword;
}
}