Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fslevoaca-ionos committed Aug 6, 2021
1 parent 9c038c8 commit fa95b71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/test/java/io/selenium/util/ContextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.support.ui.FluentWait;

import java.net.MalformedURLException;
import java.net.URL;
Expand Down Expand Up @@ -70,7 +70,7 @@ public void contextSearch() {
assertEquals("Baking item4", item.getSearchContext().findElement(By.cssSelector("span")).getText());
assertEquals("Baking item4", item.getItemWebElement().findElement(By.xpath("./span")).getText());
assertEquals("Baking item4", item.getSearchContext().findElement(By.cssSelector("span")).getText());
new WebDriverWait((WebDriver) item.getSearchContext(), Duration.ofSeconds(5)).until(ExpectedConditions.textToBe(By.cssSelector("span"), "Baking item4"));
new FluentWait<>(groceryPage.getDriver()).withTimeout(Duration.ofSeconds(5)).until(ExpectedConditions.textToBePresentInElement(item.getSearchContext().findElement(By.cssSelector("span")), "Baking item4"));
}


Expand Down
4 changes: 4 additions & 0 deletions src/test/java/io/selenium/util/pages/BasePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ public BasePage(WebDriver driver) {
PageFactory.initElements(new FieldContextDecorator(new ElementContextLocatorFactory(
driver, Duration.ofSeconds(12), Collections.singletonList(StaleElementReferenceException.class))), this);
}

public WebDriver getDriver() {
return driver;
}
}

0 comments on commit fa95b71

Please sign in to comment.