We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ca0c064 commit 3cf2edaCopy full SHA for 3cf2eda
examples/test_window_switching.py
@@ -0,0 +1,22 @@
1
+"""
2
+Sometimes tests open new tabs/windows, and you'll need
3
+to switch to them first in order to interact with them.
4
+The starting window is window(0). Then increments by 1.
5
6
+from seleniumbase import BaseCase
7
+
8
9
+class TabSwitchingTests(BaseCase):
10
11
+ def test_switch_to_tabs(self):
12
+ self.open("data:text/html,<h1>Page A</h1>")
13
+ self.assert_text("Page A")
14
+ self.open_new_window()
15
+ self.open("data:text/html,<h1>Page B</h1>")
16
+ self.assert_text("Page B")
17
+ self.switch_to_window(0)
18
19
+ self.assert_text_not_visible("Page B")
20
+ self.switch_to_window(1)
21
22
+ self.assert_text_not_visible("Page A")
0 commit comments