Steps to reproduce the issue:
- Create
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>External Navigation Test</title>
</head>
<body>
<a href="https://example.com">Click me</a>
</body>
</html>
- Create
example.goml:
goto: "file://" + |PWD| + "/index.html"
click: "a"
wait-for-document-property: {"URL": "https://example.com/"}
assert-document-property: {"URL": "https://example.com/"}
- Run the test case:
browser-ui-test --variable PWD $PWD --test-files ./example.goml
Expected result: test case completes successfully
Actual result: test case returns this error:
(line 5) Error: Execution context was destroyed, most likely because of a navigation.: for command `wait-for-document-property: {"URL": "https://example.com/"}
This issue arises because Page.waitForNavigation() is not called in wait-for-document-property.
As a workaround, you can hardcode a duration to wait for the external navigation to finish loading:
goto: "file://" + |PWD| + "/index.html"
click: "a"
// wait-for-document-property: {"URL": "https://example.com/"}
// Workaround:
wait-for: 2000
assert-document-property: {"URL": "https://example.com/"}
However, this workaround is not optimal because it unnecessarily increases the required testing time when the external page loads quickly, and falsely fails the test when the external page loads slowly.
Long-term solution should be adding the ability to call Page.waitForNavigation() somewhere in the .goml file.
Related discussion: rust-lang/rust#106391 (comment)
Steps to reproduce the issue:
index.html:example.goml:Expected result: test case completes successfully
Actual result: test case returns this error:
This issue arises because
Page.waitForNavigation()is not called inwait-for-document-property.As a workaround, you can hardcode a duration to wait for the external navigation to finish loading:
However, this workaround is not optimal because it unnecessarily increases the required testing time when the external page loads quickly, and falsely fails the test when the external page loads slowly.
Long-term solution should be adding the ability to call
Page.waitForNavigation()somewhere in the.gomlfile.Related discussion: rust-lang/rust#106391 (comment)