Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindAll method does not find elements #2999

Open
DrCrunk7098 opened this issue Dec 23, 2022 · 1 comment
Open

FindAll method does not find elements #2999

DrCrunk7098 opened this issue Dec 23, 2022 · 1 comment

Comments

@DrCrunk7098
Copy link

I am using version 3.4.3 of Serenity and find that the findAll method most of the time doesn't find any elements where the find() does find one with the same Target. I have tried grabbing a static instance of the WebDriver at startup and setting it in super() to the instance of that WebDriver. It will then begin working and later stop again. I have also seen in some cases the OnStage.actorInTheSpotlight() within the findAll() throws a NullPointerException.

Has anyone seen this and do you have some sort of solution for it. Code snippet is below:

// This is a valid selector
public static Target zoneWithString(String zoneName) {
return Target.the("Zone name " + zoneName).located(By.cssSelector("[class^=_feature_fulfillment]")).containingText(zoneName);
}

ListOfWebElementFacades elements = findAll(zoneWithString(zoneName)); // returns empty
WebElementFacade elements = find(zoneWithString(zoneName)); // returns an WebElementFacade

@DrCrunk7098
Copy link
Author

DrCrunk7098 commented Feb 16, 2023

Just a follow up on this:
ListOfWebElementFacades elements = findAll(zoneWithString(zoneName)); // returns empty
List elements = BrowseTheWeb.as(OnStage.theActorInTheSpotlight()).findElements(By.xPath(""//*[contains(text(),'" + zoneName + "')]")); // returns array with elements

Also, saving an instance of the WebDriver someplace else and using that instance to access findElements finds all the elements desired on the page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants