-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
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] = await Promise.all([
page.waitForNavigation(), // The promise resolves after navigation has finished
page.click('a.my-link'), // Clicking the link will indirectly cause a navigation
]);
- What is a
direct
navigation? What is anindirect
navigation?
From the example above, I can infer that clicking an<a href="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/">
link is anindirect
navigation. - Is submitting an html form
direct
orindirect
navigation?
Navigation via javascript/xhr/ajax is most likely an indirectnavigation
Is it safe to assume thatpage.click
only waits fordirect
navigation?- What types of navigation does
page.click
wait for automatically, as mentioned in the release notes?
EDIT: Also from the page.click documentation:
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 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:
// log in by submitting an html form
await page.click('input[value="Log in"]');
await saveScreenshot(page, fileName);
However, in the current version (0.16.0), it is now raising an error:
Cannot take a screenshot while page is navigating