-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathMyLocationForm.java
More file actions
35 lines (28 loc) · 1.33 KB
/
MyLocationForm.java
File metadata and controls
35 lines (28 loc) · 1.33 KB
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
package forms;
import aquality.selenium.elements.interfaces.IButton;
import aquality.selenium.elements.interfaces.ILabel;
import aquality.selenium.forms.Form;
import org.openqa.selenium.By;
public class MyLocationForm extends Form {
private final ILabel lblLatitude = getElementFactory().getLabel(By.xpath("//*[@id='latitude'] | (//td[contains(text(), 'Latitude')]/following-sibling::td)[1]"), "Latitude");
private final ILabel lblLongitude = getElementFactory().getLabel(By.xpath("//*[@id='longitude'] | (//td[contains(text(), 'Longitude')]/following-sibling::td)[1]"), "Longitude");
private final IButton btnConsent = getElementFactory().getButton(By.xpath("//button[@aria-label='Consent' or contains(@class,'fc-cta-consent')]"), "Consent");
public MyLocationForm() {
super(By.xpath("//*[contains(text(),'Location')]"), "My Location");
}
public Double getLatitude() {
if (!lblLatitude.state().isDisplayed() && btnConsent.state().waitForDisplayed()) {
clickConsent();
}
if (!lblLatitude.state().waitForDisplayed()) {
return null;
}
return Double.parseDouble(lblLatitude.getText());
}
public void clickConsent() {
btnConsent.click();
}
public double getLongitude() {
return Double.parseDouble(lblLongitude.getText());
}
}