Update example tests
This commit is contained in:
parent
9b09476c3a
commit
5009812927
|
@ -1,4 +1,5 @@
|
||||||
from seleniumbase import BaseCase
|
from seleniumbase import BaseCase
|
||||||
|
BaseCase.main(__name__, __file__)
|
||||||
|
|
||||||
|
|
||||||
class GitHubTests(BaseCase):
|
class GitHubTests(BaseCase):
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
""" Video Link: https://youtu.be/1s-Tj65AKZA """
|
""" Video Link: https://youtu.be/1s-Tj65AKZA """
|
||||||
from seleniumbase import BaseCase
|
from seleniumbase import BaseCase
|
||||||
|
BaseCase.main(__name__, __file__)
|
||||||
|
|
||||||
|
|
||||||
class HackTests(BaseCase):
|
class HackTests(BaseCase):
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
|
from seleniumbase.config import settings
|
||||||
from seleniumbase import BaseCase
|
from seleniumbase import BaseCase
|
||||||
|
BaseCase.main(__name__, __file__)
|
||||||
|
|
||||||
|
|
||||||
class ProxyTests(BaseCase):
|
class ProxyTests(BaseCase):
|
||||||
def test_proxy(self):
|
def test_proxy(self):
|
||||||
|
settings.SKIP_JS_WAITS = True
|
||||||
|
if not self.page_load_strategy == "none":
|
||||||
|
# This page takes too long to load otherwise
|
||||||
|
self.get_new_driver(page_load_strategy="none")
|
||||||
self.open("https://ipinfo.io/")
|
self.open("https://ipinfo.io/")
|
||||||
ip_address = self.get_text('#ip-string span[class*="primary"] span')
|
ip_address = self.get_text('#ip-string span[class*="primary"] span')
|
||||||
print("\n\nMy IP Address = %s\n" % ip_address)
|
print("\n\nMy IP Address = %s\n" % ip_address)
|
||||||
|
|
|
@ -16,10 +16,12 @@ finally:
|
||||||
|
|
||||||
# Example 2 using default args or command-line options
|
# Example 2 using default args or command-line options
|
||||||
driver = Driver()
|
driver = Driver()
|
||||||
|
try:
|
||||||
driver.get("https://seleniumbase.github.io/demo_page")
|
driver.get("https://seleniumbase.github.io/demo_page")
|
||||||
js_utils.highlight_with_js(driver, "h2", loops=5)
|
js_utils.highlight_with_js(driver, "h2", loops=5)
|
||||||
by_css = "css selector"
|
by_css = "css selector"
|
||||||
driver.find_element(by_css, "#myTextInput").send_keys("Automation")
|
driver.find_element(by_css, "#myTextInput").send_keys("Automation")
|
||||||
driver.find_element(by_css, "#checkBox1").click()
|
driver.find_element(by_css, "#checkBox1").click()
|
||||||
js_utils.highlight_with_js(driver, "img", loops=5)
|
js_utils.highlight_with_js(driver, "img", loops=5)
|
||||||
driver.quit() # If the script fails early, the driver still quits
|
finally:
|
||||||
|
driver.quit()
|
||||||
|
|
|
@ -8,6 +8,13 @@ with DriverContext() as driver:
|
||||||
driver.get("https://seleniumbase.github.io/")
|
driver.get("https://seleniumbase.github.io/")
|
||||||
js_utils.highlight_with_js(driver, 'img[alt="SeleniumBase"]', loops=6)
|
js_utils.highlight_with_js(driver, 'img[alt="SeleniumBase"]', loops=6)
|
||||||
|
|
||||||
|
with DriverContext(browser="chrome", incognito=True) as driver:
|
||||||
|
driver.get("https://seleniumbase.io/apps/calculator")
|
||||||
|
page_actions.wait_for_element(driver, "4", by="id").click()
|
||||||
|
page_actions.wait_for_element(driver, "2", by="id").click()
|
||||||
|
page_actions.wait_for_text(driver, "42", "output", by="id")
|
||||||
|
js_utils.highlight_with_js(driver, "#output", loops=6)
|
||||||
|
|
||||||
with DriverContext() as driver:
|
with DriverContext() as driver:
|
||||||
driver.get("https://seleniumbase.github.io/demo_page")
|
driver.get("https://seleniumbase.github.io/demo_page")
|
||||||
js_utils.highlight_with_js(driver, "h2", loops=5)
|
js_utils.highlight_with_js(driver, "h2", loops=5)
|
||||||
|
@ -15,10 +22,3 @@ with DriverContext() as driver:
|
||||||
driver.find_element(by_css, "#myTextInput").send_keys("Automation")
|
driver.find_element(by_css, "#myTextInput").send_keys("Automation")
|
||||||
driver.find_element(by_css, "#checkBox1").click()
|
driver.find_element(by_css, "#checkBox1").click()
|
||||||
js_utils.highlight_with_js(driver, "img", loops=5)
|
js_utils.highlight_with_js(driver, "img", loops=5)
|
||||||
|
|
||||||
with DriverContext(browser="chrome", incognito=True) as driver:
|
|
||||||
driver.get("https://seleniumbase.io/apps/calculator")
|
|
||||||
page_actions.wait_for_element(driver, "4", by="id").click()
|
|
||||||
page_actions.wait_for_element(driver, "2", by="id").click()
|
|
||||||
page_actions.wait_for_text(driver, "42", "output", by="id")
|
|
||||||
js_utils.highlight_with_js(driver, "#output", loops=6)
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from seleniumbase import BaseCase
|
from seleniumbase import BaseCase
|
||||||
|
BaseCase.main(__name__, __file__)
|
||||||
|
|
||||||
|
|
||||||
class DocsSiteTests(BaseCase):
|
class DocsSiteTests(BaseCase):
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from seleniumbase import BaseCase
|
from seleniumbase import BaseCase
|
||||||
|
BaseCase.main(__name__, __file__)
|
||||||
|
|
||||||
|
|
||||||
class SelectTestClass(BaseCase):
|
class SelectTestClass(BaseCase):
|
||||||
|
|
|
@ -4,6 +4,7 @@ Verify that one can choose a file after the hidden input is visible.
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from seleniumbase import BaseCase
|
from seleniumbase import BaseCase
|
||||||
|
BaseCase.main(__name__, __file__)
|
||||||
|
|
||||||
|
|
||||||
class FileUpload(BaseCase):
|
class FileUpload(BaseCase):
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from seleniumbase import BaseCase
|
from seleniumbase import BaseCase
|
||||||
|
BaseCase.main(__name__, __file__)
|
||||||
|
|
||||||
|
|
||||||
class TinyMceTests(BaseCase):
|
class TinyMceTests(BaseCase):
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
from seleniumbase import BaseCase
|
from seleniumbase import BaseCase
|
||||||
|
BaseCase.main(__name__, __file__)
|
||||||
|
|
||||||
|
|
||||||
class TodoMVC(BaseCase):
|
class TodoMVC(BaseCase):
|
||||||
|
|
|
@ -832,6 +832,13 @@ with DriverContext() as driver:
|
||||||
driver.get("https://seleniumbase.github.io/")
|
driver.get("https://seleniumbase.github.io/")
|
||||||
js_utils.highlight_with_js(driver, 'img[alt="SeleniumBase"]', loops=6)
|
js_utils.highlight_with_js(driver, 'img[alt="SeleniumBase"]', loops=6)
|
||||||
|
|
||||||
|
with DriverContext(browser="chrome", incognito=True) as driver:
|
||||||
|
driver.get("https://seleniumbase.io/apps/calculator")
|
||||||
|
page_actions.wait_for_element(driver, "4", by="id").click()
|
||||||
|
page_actions.wait_for_element(driver, "2", by="id").click()
|
||||||
|
page_actions.wait_for_text(driver, "42", "output", by="id")
|
||||||
|
js_utils.highlight_with_js(driver, "#output", loops=6)
|
||||||
|
|
||||||
with DriverContext() as driver:
|
with DriverContext() as driver:
|
||||||
driver.get("https://seleniumbase.github.io/demo_page")
|
driver.get("https://seleniumbase.github.io/demo_page")
|
||||||
js_utils.highlight_with_js(driver, "h2", loops=5)
|
js_utils.highlight_with_js(driver, "h2", loops=5)
|
||||||
|
@ -839,13 +846,6 @@ with DriverContext() as driver:
|
||||||
driver.find_element(by_css, "#myTextInput").send_keys("Automation")
|
driver.find_element(by_css, "#myTextInput").send_keys("Automation")
|
||||||
driver.find_element(by_css, "#checkBox1").click()
|
driver.find_element(by_css, "#checkBox1").click()
|
||||||
js_utils.highlight_with_js(driver, "img", loops=5)
|
js_utils.highlight_with_js(driver, "img", loops=5)
|
||||||
|
|
||||||
with DriverContext(browser="chrome", incognito=True) as driver:
|
|
||||||
driver.get("https://seleniumbase.io/apps/calculator")
|
|
||||||
page_actions.wait_for_element(driver, "4", by="id").click()
|
|
||||||
page_actions.wait_for_element(driver, "2", by="id").click()
|
|
||||||
page_actions.wait_for_text(driver, "42", "output", by="id")
|
|
||||||
js_utils.highlight_with_js(driver, "#output", loops=6)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
(See <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_driver_context.py">examples/raw_driver_context.py</a> for an example.)
|
(See <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_driver_context.py">examples/raw_driver_context.py</a> for an example.)
|
||||||
|
@ -874,13 +874,15 @@ finally:
|
||||||
|
|
||||||
# Example 2 using default args or command-line options
|
# Example 2 using default args or command-line options
|
||||||
driver = Driver()
|
driver = Driver()
|
||||||
|
try:
|
||||||
driver.get("https://seleniumbase.github.io/demo_page")
|
driver.get("https://seleniumbase.github.io/demo_page")
|
||||||
js_utils.highlight_with_js(driver, "h2", loops=5)
|
js_utils.highlight_with_js(driver, "h2", loops=5)
|
||||||
by_css = "css selector"
|
by_css = "css selector"
|
||||||
driver.find_element(by_css, "#myTextInput").send_keys("Automation")
|
driver.find_element(by_css, "#myTextInput").send_keys("Automation")
|
||||||
driver.find_element(by_css, "#checkBox1").click()
|
driver.find_element(by_css, "#checkBox1").click()
|
||||||
js_utils.highlight_with_js(driver, "img", loops=5)
|
js_utils.highlight_with_js(driver, "img", loops=5)
|
||||||
driver.quit() # If the script fails early, the driver still quits
|
finally:
|
||||||
|
driver.quit()
|
||||||
```
|
```
|
||||||
|
|
||||||
(From <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_browser_launcher.py">examples/raw_browser_launcher.py</a>)
|
(From <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_browser_launcher.py">examples/raw_browser_launcher.py</a>)
|
||||||
|
|
Loading…
Reference in New Issue