Skip to content

Commit

Permalink
docs: add warning about newWindow command
Browse files Browse the repository at this point in the history
  • Loading branch information
KuznetsovRoman committed Jul 26, 2024
1 parent a93f786 commit f328237
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/commands/browser/newWindow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
if (browser.isDevTools) {
const puppeteer = await browser.getPuppeteer();
await puppeteer.newPage();
} else {
await browser.newWindow("about:blank");
}

await browser.url(pageUrl);
});
```
</Admonition>
## Использование {#usage}
```javascript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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) {
if (browser.isDevTools) {
const puppeteer = await browser.getPuppeteer();
await puppeteer.newPage();
} else {
await browser.newWindow("about:blank");
}

await browser.url(pageUrl);
});
```
</Admonition>
## Usage {#usage}
```javascript
Expand Down

0 comments on commit f328237

Please sign in to comment.