Skip to content

docs: add warning about newWindow command #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/commands/browser/newWindow.mdx
Original file line number Diff line number Diff line change
@@ -12,6 +12,24 @@ import Admonition from "@theme/Admonition";

<Admonition type="warning">Команда _newWindow_ не работает в мобильных окружениях (!)</Admonition>

<Admonition type="warning">
Команда может не работать c _devtools_ протоколом. Также она не дожидается загрузки страницы.
Чтобы решить эти проблемы, рекомендуется перезаписать команду (на стороне Testplane это будет сделано в версии 9.0.0):
```javascript
browser.overwriteCommand("newWindow", async function(pageUrl, windowName, windowFeatures) {
if (browser.isDevTools) {
const puppeteer = await browser.getPuppeteer();
await puppeteer.newPage();
} else {
await browser.newWindow("about:blank", windowName, windowFeatures);
}

await browser.url(pageUrl);
});
```

</Admonition>

## Использование {#usage}

```javascript
Original file line number Diff line number Diff line change
@@ -14,6 +14,24 @@ Note that this command will automatically switch you to the new window upon exec
The _newWindow_ command does not work in mobile environments (!)
</Admonition>

<Admonition type="warning">
The command might not work with _devtools_ protocol. It also does not wait untill page load.
In order to fix these problems, it is recommended to overwrite the command (on the Testplane side it would be done in version 9.0.0):
```javascript
browser.overwriteCommand("newWindow", async function(pageUrl, windowName, windowFeatures) {
if (browser.isDevTools) {
const puppeteer = await browser.getPuppeteer();
await puppeteer.newPage();
} else {
await browser.newWindow("about:blank", windowName, windowFeatures);
}

await browser.url(pageUrl);
});
```

</Admonition>

## Usage {#usage}

```javascript