I've got an application which I want to test with selenium/codeception. It has a lot of ajax function which changes the pages (show/hide sections of the page) which codeception at the moment doesn't handle well.
The problem I am having is I want to click on buttons/elements which either
If I use waitForElement() it only seems to works in the second case (it waits for the element to appear and continues) but if the element is already present waitForElement will timeout and fire an Fail.
What I am looking for is a seeOrWaitForElement() function but I can't figure out how to insert logic in codeception.
Is this function available somewhere or how can I solve this problem in another way?
You could use
waitForJs("return document.querySelector('".$element."') != null", $seconds);
which will wait until the element exists (and returns instantly if the element already is present).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With