Now xk6-browser is integrated with k6, but how can I change the xk6 version?
Thank you,
Best Regards,
Now xk6-browser is integrated with k6, but how can I change the xk6 version?
Thank you,
Best Regards,
Hi @f.gardin !
In regards of the title question, the k6 v0.43.0 is already using the xk6-browser v0.8.1. Are you experiencing any unexpected problems in relation with this?
You can expect every new k6 release to use the latest xk6-browser version.
You can still build custom binaries for specific extension versions with the usage of xk6, but as per xk6-browser the recommended way is to use the latest k6 release.
Let me know if this solves your question or if you are experiencing further problems.
The method page.url() is not working for me, I thought there is a version problem with xk6-browser, so I found in the k6 github:
“All xk6-browser scripts that work with v0.8.0 will continue to work with the built-in module in k6 v0.43.0.”
I tried to uninstall and install again but it didn’t work
Hey @f.gardin , ok. Could you paste here the script that you are running and the error output please?
Thank you.
Hello @Daniel.J ,
My apologies about late reply, below it is possible to see an example code:
import { chromium } from 'k6/experimental/browser';
//to run this script run the command K6_BROWSER_ENABLED=true k6 run script.js in git bash
export default async function () {
const browser = chromium.launch({ headless: false });
const page = browser.newPage();
try {
await page.goto('https://test.k6.io/', { waitUntil: 'networkidle' });
console.log(page.url());
page.screenshot({ path: 'screenshot.png' });
} finally {
page.close();
browser.close();
}
}
And the log error:
INFO[0002] https://test.k6.io/ source=console
ERRO[0003] cleaning up the user data directory: remove C:\Users\FD1DF~1.GAR\AppData\Local\Temp\xk6-browser-data-2925870955\Default\Affiliation Database: The process cannot access the file because it is being used by another process. category="Browser:Close" elapsed="0 ms" goroutine=68
ERRO[0003] process with PID 17440 unexpectedly ended: exit status 1 category=browser elapsed="7 ms" goroutine=72
If I send the command k6 version, I will got:
k6 v0.43.1 (2023-02-27T10:53:03+0000/v0.43.1-0-gaf3a0b89, go1.19.6, windows/amd64)
Hi @f.gardin, thanks for providing the script.
So the core part of the script should run fine, logging the URL and taking the screenshot, the problem is related with the cleanup when closing the browser. This seems fail sometimes in Windows and MacOS due to permission problems. We have an issue to try to improve it here.
Is this a consistent error in your case?
Yes, it is, I will try to run this via linux virtual machine