-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
bugUh oh... Something needs to be fixedUh oh... Something needs to be fixed
Description
I wrote two demo pages,You can try this locally
Page A:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Page A</title>
</head>
<body>
<form>
<input type="button" value="login" onclick="change()">
</form>
<script>
function change(){
window.open("Page B.html");
}
</script>
</body>
</html>
Page B:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Page B</title>
</head>
<body>
<form>
<input type="button" value="close" onclick="change()">
</form>
<script>
function change(){
window.close();
}
</script>
</body>
</html>
Normally, after clicking the button to close the page, we use self.switch_to_window(-1)
to go back to the original page, but it throws an exception before it gets that far
testcae:
from seleniumbase import BaseCase
class DemoTestCase(BaseCase):
def test_demo(self):
self.open("file:///D:/from/your/path/Page A.html")
self.sleep(2)
self.click("//input[@value='login']")
self.sleep(2)
self.click("//input[@value='close']") # The error occurs on this line
self.sleep(2)
self.switch_to_window(-1)
self.click("//button[@value='login']")
Metadata
Metadata
Assignees
Labels
bugUh oh... Something needs to be fixedUh oh... Something needs to be fixed