Skip to content

Commit c2fd5c6

Browse files
committed
Update example tests
1 parent 0d61ce9 commit c2fd5c6

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

examples/raw_file_call.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
"""Call a file with "python" instead of using "pytest" directly.
1+
"""Call a file with "python" instead of "pytest".
22
To run, use: "python raw_file_call.py".
33
On newer version of SeleniumBase, use:
44
BaseCase.main(__name__, __file__)"""
55
from seleniumbase import BaseCase
66

7-
if __name__ == "__main__": # If "python", run pytest
7+
if __name__ == "__main__":
88
from pytest import main
99
main([__file__, "-s"])
1010

examples/test_parse_soup.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ def test_beautiful_soup_and_tinymce(self):
2626
self.type('input[aria-label="Width"].mce-textbox', "300")
2727
image_url = "https://seleniumbase.github.io/img/sb_logo_10.png"
2828
self.type("input.mce-textbox", image_url + "\n")
29-
self.switch_to_frame("iframe")
30-
self.click("h2")
31-
self.switch_to_default_content()
32-
self.post_message("Automate anything with SeleniumBase!")
29+
with self.frame_switch("iframe"):
30+
self.click("h2")
31+
self.post_message("Automate anything with SeleniumBase!")
3332
self.click_menu_item("File")
3433
self.click_menu_item("Preview")
35-
self.switch_to_frame('iframe[sandbox="allow-scripts"]')
36-
self.post_message("Learn SeleniumBase Today!")
34+
with self.frame_switch('iframe[sandbox="allow-scripts"]'):
35+
self.post_message("Learn SeleniumBase Today!")

examples/test_tinymce.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ def test_tinymce(self):
1111
self.click('span:contains("Heading 2")')
1212
self.switch_to_frame("iframe")
1313
self.add_text("#tinymce", "Automate anything with SeleniumBase!\n")
14-
self.switch_to_default_content()
14+
self.switch_to_parent_frame()
1515
self.click("button i.mce-i-image")
1616
self.type('input[aria-label="Width"].mce-textbox', "300")
1717
image_url = "https://seleniumbase.github.io/img/sb_logo_10.png"
1818
self.type("input.mce-textbox", image_url + "\n")
19-
self.switch_to_frame("iframe")
20-
self.click("h2")
21-
self.post_message("Automate anything with SeleniumBase!")
22-
self.switch_to_default_content()
19+
with self.frame_switch("iframe"):
20+
self.click("h2")
21+
self.post_message("Automate anything with SeleniumBase!")
2322
self.click('span:contains("File")')
2423
self.click('span:contains("Preview")')
2524
self.switch_to_frame('iframe[sandbox="allow-scripts"]')

0 commit comments

Comments
 (0)