serenity-bdd / serenity-core

Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.
http://serenity-bdd.info
Other
719 stars 516 forks source link

FindAll method does not find elements #2999

Open DrCrunk7098 opened 1 year ago

DrCrunk7098 commented 1 year ago

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 commented 1 year ago

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.