You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the release notes of 0.14.0, under Breaking API Changes, there is a phrase that says:
Actions that automatically wait for the navigation like page.click(selector[, options]) ...etc.
I need help understanding what that means. In the current documentation for page.waitForNavigation, the page.waitForNavigation and page.click promise combo is shown as an example for properly handling indirect navigation:
const[response]=awaitPromise.all([page.waitForNavigation(),// The promise resolves after navigation has finishedpage.click('a.my-link'),// Clicking the link will indirectly cause a navigation]);
What is a direct navigation? What is an indirect navigation?
From the example above, I can infer that clicking an <a href="/"> link is an indirect navigation.
Is submitting an html form direct or indirect navigation?
Navigation via javascript/xhr/ajax is most likely an indirect navigation
Is it safe to assume that page.click only waits for direct navigation?
What types of navigation does page.click wait for automatically, as mentioned in the release notes?
noWaitAfter - Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to false.
If clicking an <a href> link is an indirect navigation, meaning the noWaitAfter doesn't apply, meaning page.waitForNavigation is needed, which navigations does the docs pertain to?
The reason I ask is, in the previous playwright version, 0.13.0, my tests which included the following lines, worked fine:
// log in by submitting an html formawaitpage.click('input[value="Log in"]');awaitsaveScreenshot(page,fileName);
However, in the current version (0.16.0), it is now raising an error:
Cannot take a screenshot while page is navigating
The text was updated successfully, but these errors were encountered:
page.click() on a regular link waits for the navigation to be confirmed. This is a navigation synchronously triggered by the click.
page.click() on a button that navigates in a setTimeout or after making an xhr/fetch does not wait for the navigation. This is a navigation asynchronously triggered by the click.
The breaking change in 0.14 was that page.click() will not additionally wait for the domcontentloaded or load state, only for the navigation to be confirmed. This means the new page might not be fully loaded yet.
For the snippet that clicks and then takes a screenshot, it is usually a good idea to wait at least for the load before taking a screenshot, because you want all images, styles, etc. to load.
In the release notes of 0.14.0, under Breaking API Changes, there is a phrase that says:
I need help understanding what that means. In the current documentation for page.waitForNavigation, the
page.waitForNavigation
andpage.click
promise combo is shown as an example for properly handlingindirect
navigation:direct
navigation? What is anindirect
navigation?From the example above, I can infer that clicking an
<a href="/">
link is anindirect
navigation.direct
orindirect
navigation?Navigation via javascript/xhr/ajax is most likely an indirect
navigation
Is it safe to assume thatpage.click
only waits fordirect
navigation?page.click
wait for automatically, as mentioned in the release notes?EDIT: Also from the page.click documentation:
<a href>
link is anindirect
navigation, meaning the noWaitAfter doesn't apply, meaningpage.waitForNavigation
is needed, which navigations does the docs pertain to?The reason I ask is, in the previous playwright version, 0.13.0, my tests which included the following lines, worked fine:
However, in the current version (0.16.0), it is now raising an error:
The text was updated successfully, but these errors were encountered: