Open ampractise opened 2 years ago
Hi @ampractise, I tried to run your script (both headful and headless), and it worked fine. Which xk6-browser version are you using? By the way, we don't recommend using sleep
in a script. I used page.waitForNavigation();
instead of sleep
and waitForSelector
, it also worked fine.
I am using xk6-browser-v0.3.0-windows-amd64.zip, and when I add page.waitForNavigation(), I got below error,
I've tried this again on OSX (xk6-browser v0.3.0) with the following change, and it worked both ways (headful and headless). Can you try it with the following change as well? It may be an issue on Windows. Thanks.
...
page.goto("https://www.saucedemo.com/", { waitUntil: 'load' });
page.$("input[id='user-name']").type("standard_user");
page.$("input[id='password']").type("secret_sauce");
// Notice these lines.
page.waitForSelector('input#login-button').click()
page.waitForSelector("a[class='shopping_cart_link']");
page.close();
browser.close();
...
In this change, you wait until the login button appears, and then you click on it.
Getting same outcome for your suggested code, also tried on different windows machine,
Can I learn about the Windows and Chrome version you're using?
When Headless is true
When headless is false