help with using WaitUntil when passing $$ selected page object elements to a separate function #12001
-
hi there, I know I'm doing this wrong but I am not sure how to correct my incorrect logic. So I have a WaitUntil piece of code that works correctly within the Test Script but when I try to move it to a separate function I am not getting it to work properly
but if i now want to try and make this a repeatable function it doesnt work
Any guidance would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
@troyyer what's the error you are seeing? The code looks ok to me. |
Beta Was this translation helpful? Give feedback.
-
@christian-bromann To add more information,
I had read your comment in this discussion #6746 (reply in thread) and you had mentioned that " if you define this value before then it would never be updated." so is this potentially the issue I am facing because I am passing the Page object to the function? |
Beta Was this translation helpful? Give feedback.
-
@christian-bromann, yup I will definitely be going to update to V8 in the near future i have 3 tests running and the test named "tests dynamic loading length to function" always fails for me
|
Beta Was this translation helpful? Give feedback.
Hey @troyyer , thanks for providing the example, it made things very clear. As you already have mentioned above when fetching elements through WebdriverIO, you will obtain an element reference which doesn't update unless you refetch it. In your function you pass in an element reference (of an empty element array) and continue to ask for the length which always remains
0
. A workaround would be:The
selector
property enables you to make the same request again and get an updated value…