ohos-playwright 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fixture.mjs +12 -4
- package/package.json +1 -1
package/dist/fixture.mjs
CHANGED
|
@@ -38,10 +38,17 @@ export async function installPageWrappers(page, context, baseURL) {
|
|
|
38
38
|
finally {
|
|
39
39
|
await session.detach();
|
|
40
40
|
}
|
|
41
|
-
// Override
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
;
|
|
41
|
+
// Override goto: connectOverCDP creates the server-side context with no baseURL in
|
|
42
|
+
// its _options, so Playwright's internal Frame.goto cannot resolve relative paths —
|
|
43
|
+
// CDP rejects them as invalid. Resolve here before delegating to the real goto.
|
|
44
|
+
const savedGoto = page['goto'];
|
|
45
|
+
const origGoto = page.goto.bind(page);
|
|
46
|
+
page.goto = async (url, options) => {
|
|
47
|
+
if (baseURL && url && !url.includes('://') && !url.startsWith('about:') && !url.startsWith('data:')) {
|
|
48
|
+
url = new URL(url, baseURL).toString();
|
|
49
|
+
}
|
|
50
|
+
return origGoto(url, options);
|
|
51
|
+
};
|
|
45
52
|
page.goBack = async (options) => {
|
|
46
53
|
const timeout = options?.timeout ?? 30000;
|
|
47
54
|
const s = await page.context().newCDPSession(page);
|
|
@@ -165,6 +172,7 @@ export async function installPageWrappers(page, context, baseURL) {
|
|
|
165
172
|
clearInterval(popupPoller);
|
|
166
173
|
page.evaluate = savedEvaluate;
|
|
167
174
|
page.locator = savedLocator;
|
|
175
|
+
page.goto = savedGoto;
|
|
168
176
|
if (opts?.navigateTo) {
|
|
169
177
|
// Reset the shared tab to a neutral state — page.close() would terminate
|
|
170
178
|
// the ArkWeb DevTools socket so we navigate instead.
|