try {
await page.goto(url);
await page.locator('//*[@id="username-authenticator"]').click();
sleep(1)
await page.locator('//input[@id="username"]').type(ssns[u]);
sleep(1);
await page.locator('//bp-button[@id="login"]').click();
sleep(1);
await page.screenshot({ path: 'screenshots/screenshot' + ssns[u] + '.png' });
} catch (err) {
console.log("Error:" + err);
await page.screenshot({ path: 'screenshots/error.png' });
} finally {
await page.close();
}
Why do I need those sleeps, I believed we had a 30sec timeout per default on locator.
it not it just fails at 2nd locator:
INFO[0003] Error:typing "16856799232" in "//input[@id=\"username\"]": Cannot find context with specified id source=console
Hi @mortenb123,
You don’t need to use sleep
s, and we don’t recommend using it. Please check out this article on how to wait for actions.
Thanks!
1 Like
thanks, K6/http and K6/browser behave differently. I’ll try to see if I can get the swing of it.
I have the test perfectly aligned in both selenium and playwright with python put it is singlethreaded. Even if I use only xpath and css selectors it is not the same.
1 Like
I used:
await page.locator.waitForSelector('bp-login-button#username-authenticator');
await page.locator('bp-login-button#username-authenticator').click();
without the first line it will not find the 2nd, nice if you update the documentation with some examples. Feks a multthread search test on google.com to show us how to get the most threads though as fast as possible. It is a terrific tool 
1 Like