Update the example tests

This commit is contained in:
Michael Mintz 2022-02-15 17:30:03 -05:00
parent 8963b27fe7
commit e770ae7c64
2 changed files with 22 additions and 2 deletions

View File

@ -0,0 +1,20 @@
from selenium import webdriver
from seleniumbase import BaseCase
class OverrideDriverTest(BaseCase):
def get_new_driver(self, *args, **kwargs):
""" This method overrides get_new_driver() from BaseCase. """
options = webdriver.ChromeOptions()
options.add_experimental_option(
"excludeSwitches", ["enable-automation"]
)
options.add_experimental_option("useAutomationExtension", False)
if self.headless:
options.add_argument("--headless")
return webdriver.Chrome(options=options)
def test_simple(self):
self.open("https://seleniumbase.io/demo_page")
self.assert_text("Demo Page", "h1")

View File

@ -30,7 +30,7 @@ class ShadowDomTests(BaseCase):
# Download Python package files from PyPI
file_name_1 = self.download_tar_file_from_pypi("sbase")
file_name_2 = self.download_tar_file_from_pypi("tensorpy")
file_name_2 = self.download_tar_file_from_pypi("seleniumbase")
self.assert_downloaded_file(file_name_1, browser=True)
self.assert_downloaded_file(file_name_2, browser=True)
@ -67,7 +67,7 @@ class ShadowDomTests(BaseCase):
self.type(search_input, "sbase")
self.assert_text(file_name_1, file_link)
print("\n Download 1: %s" % self.get_text(file_link))
self.type(search_input, "tensorpy")
self.type(search_input, "seleniumbase")
self.assert_text(file_name_2, file_link)
print(" Download 2: %s" % self.get_text(file_link))
self.click(clear_search_icon)