Is it possilbe to use while (I.seeElement(element) == false) {
do the following
}
I just get an expected true not equal to false failure as below.
log result is below.
expected elements of elementLocatorHere to be seen
+ expected - actual
-false
+true
Scenario Steps:
93) I.seeElement(elementLocatorHere)
The code snippet is here.
while (I.seeElement(elementLocatorHere) == false) {
I.click(elementLocatorHere);
I.pressKey(somethinghere');
I.click(elementLocatorHere;
}
Calls inside 'I' don't return values (except grab functions, that you call with yield). So I.seeElement will fail the test if it doesn't see it.
Besides that, I functions are not called as they come in code, they are all added to a chain of promised to later be executed, so logic like the one you are trying to do is a bit complicated to do.
Usually you should know how many clicks you need to do before the element appear, unless there is a random logic attach to it, then I'm not sure how to solve it.
Nothing to add. Using loops inside tests is a bad smell. If you need to use something like that: probably you need to have implement that in custom helper
For those who came here from Google this Gist might be helpful: _Example of custom helper to perform conditional click (without throwing an error)_.
Most helpful comment
Nothing to add. Using loops inside tests is a bad smell. If you need to use something like that: probably you need to have implement that in custom helper