I'm using Playwright 1.12 + Chromium 90 for daily Router restarts.
My script navigates to router's page 1.1.1.1/reset.asp
Then script click's button, accept dialog, and magic is happening inside router.
Now I have two options to have sure that router has been restarted successfully:
- Detect if connection in browser went "offline" (that's a good sign, I wish to wait for this event)
- Wait until
page.url()
change to1.1.1.1
(URL in browser is changing for this one when router is UP again)
Can you give me any ideas how to achieve one of these two points?
The best would be waiting until connection in browser is offline.
Example code:
async function login() {
// some stuff here
await reset();
}
async function reset() {
// some stuff here
// current URL is 1.1.1.1/reset.asp
page.on('dialog', async dialog => {
await dialog.accept();
// I WANT TO CHANGE THIS DELAY FOR SOMETHING LIKE:
// await waitUntilConnectionGoesDown()
await delay(5000);
await finish(true);
});
await frame.click('#reboot');
// OR HERE WAIT FOR URL CHANGE
// await waitForUrlChange()
// await finish(true);
}
async function finish(success) {
// success ? CLOSING BROWSER : DOING SOMETHING ELSE;
}