Issue
I'm trying to find a Target that is a snack-bar with a message and a button that is only visible for 3 seconds after I click on a button:
If I pause the debugger I do find the element with the css selector .mat-snack-bar-container
:
But in the code when I try to get the Target with the same selector it is never found not as a Target nor if I use the driver to find the element:
actor.attemptsTo(WaitUntil.the(SnackBar.SNACK_BAR_CONTAINER,isCurrentlyVisible()).forNoMoreThan(10).seconds());
I've tried isCurrentlyVisible
, isVisible
, isPresent
and nothing.
With findElement I also get nothing:
WebElement snackBar = webDriver.findElement((By.cssSelector(".mat-snack-bar-container")));
When I see the screenshots of the steps I do see the snack-bar...
Any ideas? Thanks!
Solution
I found out why the actor was not able to find the snack-bar. In the file serenity.properties
I had this line: serenity.step.delay=2500
which is just the time that this element was visible.
If I used the driver directly this was not affected and I could see the snack-bar both in the screenshots and in the pagesource. But using the actor I could only see it in the screenshots and sometimes.
Once I lowered the step delay to 500 I was able to find the element.
Thanks everyone for you help!
Answered By - republicca
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.