Update raw Selenium examples

This commit is contained in:
Michael Mintz 2022-10-23 10:34:48 -04:00
parent 64ebebee47
commit 9e120bd405
5 changed files with 23 additions and 18 deletions

View File

@ -1,5 +1,4 @@
"""Flaky Raw Selenium Example - (This test does NOT use SeleniumBase)"""
import pytest
"""Flaky Raw Selenium Example - (ONLY Selenium / NO SeleniumBase)"""
import sys
from selenium import webdriver
from selenium.webdriver.common.by import By
@ -66,6 +65,8 @@ class FlakyMessyRawSelenium(TestCase):
self.driver.find_element(by_css, "input#login-button")
# When run with "python" instead of "pytest"
# When run with "python" instead of "pytest" or "python -m unittest"
if __name__ == "__main__":
pytest.main([__file__])
from unittest import main
main()

View File

@ -1,5 +1,4 @@
"""Long & Messy Raw Selenium Example - (This test does NOT use SeleniumBase)"""
import pytest
"""Long & Messy Raw Selenium Example - (ONLY Selenium / NO SeleniumBase)"""
import sys
from selenium import webdriver
from selenium.webdriver.common.by import By
@ -90,6 +89,8 @@ class LongMessyRawSelenium(TestCase):
)
# When run with "python" instead of "pytest"
# When run with "python" instead of "pytest" or "python -m unittest"
if __name__ == "__main__":
pytest.main([__file__])
from unittest import main
main()

View File

@ -1,5 +1,4 @@
"""Messy Raw Selenium Example - (This test does NOT use SeleniumBase)"""
import pytest
"""Messy Raw Selenium Example - (ONLY Selenium / NO SeleniumBase)"""
import sys
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
@ -78,6 +77,8 @@ class MessyRawSelenium(TestCase):
self.wait_for_element_visible("input#login-button")
# When run with "python" instead of "pytest"
# When run with "python" instead of "pytest" or "python -m unittest"
if __name__ == "__main__":
pytest.main([__file__])
from unittest import main
main()

View File

@ -1,5 +1,4 @@
"""Refined Raw Selenium Example - (This test does NOT use SeleniumBase)"""
import pytest
"""Refined Raw Selenium Example - (ONLY Selenium / NO SeleniumBase)"""
import sys
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
@ -120,6 +119,8 @@ class RefinedRawSelenium(TestCase):
self.assert_element("input#login-button")
# When run with "python" instead of "pytest"
# When run with "python" instead of "pytest" or "python -m unittest"
if __name__ == "__main__":
pytest.main([__file__])
from unittest import main
main()

View File

@ -1,5 +1,4 @@
"""Clean SeleniumBase Example - (Uses simple, reliable methods)"""
import pytest
from seleniumbase import BaseCase
@ -23,4 +22,6 @@ class CleanSeleniumBase(BaseCase):
# When run with "python" instead of "pytest"
if __name__ == "__main__":
pytest.main([__file__])
from pytest import main
main([__file__])