I am waiting for an overlay to appear. Is there a specific wait_for method or should I run a loop with a timeout?
Thanks
I am waiting for an overlay to appear. Is there a specific wait_for method or should I run a loop with a timeout?
Thanks
Hi,
k6 doesn’t actually process or execute website assets like a browser does. Instead it offers a user-friendly JavaScript API to make HTTP requests in your scripts, which you can think of as being similar to jQuery or cURL.
So while there is no specific wait_for
method, you can replicate some of the functionality by manually sleeping, and then inspecting the HTML with parseHTML()
and the helper Selection and Element APIs. Of course, this will depend on the application you’re testing to return rendered HTML, so it’s not a good solution for SPA or frontend-heavy applications. k6 is more focused towards testing API servers and HTTP performance than user-facing frontend features, otherwise it would have to behave more like a browser.
Hope this helps,
Ivan
Also, see this answer in another thread: Question on http.get - #6 by mark
You can generate a HAR file in Chrome, Firefox or other tools, which is a recording of the requests made in a user session of your app, and then use the k6 convert
command to convert the HAR file to a k6 JS script, which can be run as usual.
See the following links for details:
k6 convert
)