Skip to content

Commit 7d0f209

Browse files
docs: add warning about newWindow command
1 parent a93f786 commit 7d0f209

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

Diff for: docs/commands/browser/newWindow.mdx

+18
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@ import Admonition from "@theme/Admonition";
1212

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

15+
<Admonition type="warning">
16+
Команда может не работать c _devtools_ протоколом. Также она не дожидается загрузки страницы.
17+
Чтобы решить эти проблемы, рекомендуется перезаписать команду (на стороне Testplane это будет сделано в версии 9.0.0):
18+
```javascript
19+
browser.overwriteCommand("newWindow", async function(pageUrl) {
20+
if (browser.isDevTools) {
21+
const puppeteer = await browser.getPuppeteer();
22+
await puppeteer.newPage();
23+
} else {
24+
await browser.newWindow("about:blank");
25+
}
26+
27+
await browser.url(pageUrl);
28+
});
29+
```
30+
31+
</Admonition>
32+
1533
## Использование {#usage}
1634
1735
```javascript

Diff for: i18n/en/docusaurus-plugin-content-docs/current/commands/browser/newWindow.mdx

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

17+
<Admonition type="warning">
18+
The command might not work with _devtools_ protocol. It also does not wait untill page load.
19+
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):
20+
```javascript
21+
browser.overwriteCommand("newWindow", async function(pageUrl) {
22+
if (browser.isDevTools) {
23+
const puppeteer = await browser.getPuppeteer();
24+
await puppeteer.newPage();
25+
} else {
26+
await browser.newWindow("about:blank");
27+
}
28+
29+
await browser.url(pageUrl);
30+
});
31+
```
32+
33+
</Admonition>
34+
1735
## Usage {#usage}
1836
1937
```javascript

0 commit comments

Comments
 (0)