Add an example test that has switching to a new tab/window
This commit is contained in:
parent
ca0c064ff5
commit
3cf2eda808
|
@ -0,0 +1,22 @@
|
|||
"""
|
||||
Sometimes tests open new tabs/windows, and you'll need
|
||||
to switch to them first in order to interact with them.
|
||||
The starting window is window(0). Then increments by 1.
|
||||
"""
|
||||
from seleniumbase import BaseCase
|
||||
|
||||
|
||||
class TabSwitchingTests(BaseCase):
|
||||
|
||||
def test_switch_to_tabs(self):
|
||||
self.open("data:text/html,<h1>Page A</h1>")
|
||||
self.assert_text("Page A")
|
||||
self.open_new_window()
|
||||
self.open("data:text/html,<h1>Page B</h1>")
|
||||
self.assert_text("Page B")
|
||||
self.switch_to_window(0)
|
||||
self.assert_text("Page A")
|
||||
self.assert_text_not_visible("Page B")
|
||||
self.switch_to_window(1)
|
||||
self.assert_text("Page B")
|
||||
self.assert_text_not_visible("Page A")
|
Loading…
Reference in New Issue