Update example tests

This commit is contained in:
Michael Mintz 2022-09-01 16:25:59 -04:00
parent 5139e390f9
commit bc92b3fd5b
2 changed files with 18 additions and 0 deletions

View File

@ -63,6 +63,7 @@ if pure_python:
sb.enable_ws = False
sb.enable_sync = False
sb.use_auto_ext = False
sb.undetectable = False
sb.no_sandbox = False
sb.disable_gpu = False
sb._multithreaded = False

View File

@ -0,0 +1,17 @@
"""
Determine if your browser is detectable by anti-bot services.
Some sites use scripts to detect Selenium and then block you.
To evade detection, add --uc as a pytest command-line option.
"""
from seleniumbase import BaseCase
class UndetectedTest(BaseCase):
def test_browser_is_undetected(self):
self.open("https://nowsecure.nl")
try:
self.assert_text("OH YEAH, you passed!", "h1", timeout=6.6)
self.post_message("Browser wasn't detected!", duration=1.6)
self._print("\n Success! Website did not detect Selenium!")
except Exception:
self.fail('Browser was detected! Try using: "pytest --uc"')