diff --git a/src/test/java/forms/MyLocationForm.java b/src/test/java/forms/MyLocationForm.java index 39f7007..2d94aed 100644 --- a/src/test/java/forms/MyLocationForm.java +++ b/src/test/java/forms/MyLocationForm.java @@ -1,5 +1,6 @@ package forms; +import aquality.selenium.elements.interfaces.IButton; import aquality.selenium.elements.interfaces.ILabel; import aquality.selenium.forms.Form; import org.openqa.selenium.By; @@ -8,13 +9,21 @@ public class MyLocationForm extends Form { private final ILabel lblLatitude = getElementFactory().getLabel(By.id("latitude"), "Latitude"); private final ILabel lblLongitude = getElementFactory().getLabel(By.id("longitude"), "Longitude"); + private final IButton btnConsent = getElementFactory().getButton(By.xpath("//button[@aria-label='Consent']"), "Consent"); public MyLocationForm() { super(By.xpath("//h1[contains(text(),'My Location')]"), "My Location"); } public double getLatitude() { - return Double.parseDouble(lblLatitude.getText()); + if (!lblLatitude.state().isDisplayed() && btnConsent.state().isDisplayed()) { + clickConsent(); + } + return Double.parseDouble(lblLatitude.getText()); + } + + public void clickConsent() { + btnConsent.click(); } public double getLongitude() { diff --git a/src/test/java/theinternet/forms/JQueryMenuForm.java b/src/test/java/theinternet/forms/JQueryMenuForm.java index 1b911be..fcbb9b0 100644 --- a/src/test/java/theinternet/forms/JQueryMenuForm.java +++ b/src/test/java/theinternet/forms/JQueryMenuForm.java @@ -5,7 +5,7 @@ import org.openqa.selenium.By; public class JQueryMenuForm extends TheInternetForm { - private final IButton btnEnabled = getElementFactory().getButton(By.id("ui-id-2"), "Enabled"); + private final IButton btnEnabled = getElementFactory().getButton(By.id("ui-id-3"), "Enabled"); public JQueryMenuForm(){ super(By.id("menu"), "JQueryUI menu"); diff --git a/src/test/java/theinternet/forms/TheInternetForm.java b/src/test/java/theinternet/forms/TheInternetForm.java index 67b8603..67bb737 100644 --- a/src/test/java/theinternet/forms/TheInternetForm.java +++ b/src/test/java/theinternet/forms/TheInternetForm.java @@ -10,7 +10,7 @@ public abstract class TheInternetForm extends Form { super(locator, name); } - private static final String THE_INTERNET_FORM_URL = "http://the-internet.herokuapp.com"; + private static final String THE_INTERNET_FORM_URL = "https://the-internet.herokuapp.com"; private final ILink elementalSeleniumLink = getElementFactory().getLink(By.xpath("//a[contains(@href,'elementalselenium')]"), "Elemental Selenium"); public String getUrl() { diff --git a/src/test/resources/settings.json b/src/test/resources/settings.json index 65dda0a..db5aad0 100644 --- a/src/test/resources/settings.json +++ b/src/test/resources/settings.json @@ -1,5 +1,5 @@ { - "browserName" : "iexplorer", + "browserName" : "chrome", "isRemote": false, "remoteConnectionUrl": "http://localhost:4444/wd/hub", "isElementHighlightEnabled" : true,