Skip to content

Commit

Permalink
fix: FavouritesPowerSearchIntegration (#5008)
Browse files Browse the repository at this point in the history
  • Loading branch information
edalex-yinzi authored Feb 20, 2024
1 parent 7a3967a commit 918d326
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.internal.WrapsElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
Expand Down Expand Up @@ -87,8 +88,9 @@ public List<SR> getResults() {
List<SR> results = new ArrayList<SR>();

if (isResultsAvailable()) {
int count =
getResultsDiv().findElements(By.xpath("//div[@class='itemresult-wrapper']")).size();
By items = By.xpath("//div[@class='itemresult-wrapper']");
waiter.until(ExpectedConditions.presenceOfAllElementsLocatedBy(items));
int count = getResultsDiv().findElements(items).size();

for (int i = 1; i <= count; i++) {
results.add(getResult(i));
Expand Down Expand Up @@ -122,6 +124,7 @@ public boolean doesResultExist(PrefixedName title) {
public boolean doesResultExist(String title) {
boolean found = false;
int size = getResults().size();

for (int i = 1; i <= size; i++) {
found = doesResultExist(title, i);
if (found) {
Expand All @@ -132,6 +135,13 @@ public boolean doesResultExist(String title) {
}

public boolean isResultsAvailable() {
return isPresent(By.xpath("//div[@class='itemresult-wrapper']"));
try {
waiter.until(
ExpectedConditions.presenceOfElementLocated(
By.xpath("//div[@class='itemresult-wrapper']")));
return true;
} catch (TimeoutException Time) {
return false;
}
}
}

0 comments on commit 918d326

Please sign in to comment.