-
Notifications
You must be signed in to change notification settings - Fork 979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SeleniumBase UC Mode needs a video tutorial #2000
Labels
Comments
mdmintz
changed the title
SeleniumBase needs a video tutorial for UC Mode
SeleniumBase UC Mode needs a video tutorial
Aug 14, 2023
Here's a multithreaded example that can be run with import pytest
from random import randint
from seleniumbase import BaseCase
BaseCase.main(__name__, __file__, "--uc", "-n4")
@pytest.mark.parametrize("", [[]] * 4)
def test_multi_threaded(sb):
sb.driver.get("https://nowsecure.nl/#relax")
sb.set_window_rect(randint(0, 750), randint(0, 400), 700, 500)
try:
sb.assert_text("OH YEAH, you passed!", "h1", timeout=5.25)
sb.post_message("Selenium wasn't detected!", duration=2.8)
sb._print("\n Success! Website did not detect Selenium! ")
except Exception:
sb.driver.get("https://nowsecure.nl/#relax")
try:
sb.assert_text("OH YEAH, you passed!", "h1", timeout=5.25)
sb.post_message("Selenium wasn't detected!", duration=2.8)
sb._print("\n Success! Website did not detect Selenium! ")
except Exception:
sb.fail('Selenium was detected! Try using: "pytest --uc"') |
The video is ready. Enjoy! https://www.youtube.com/watch?v=5dMFI3e85ig |
See https://www.youtube.com/@MichaelMintz/videos for my YouTube channel. See https://www.youtube.com/playlist?list=PLp9uKicxkBc5UIlGi2BuE3aWC7JyXpD3m for the SeleniumBase playlist. |
Closing this ticket in favor of the newer #2213 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
SeleniumBase UC Mode needs a video tutorial
There should first be a prelude on how sites detect Selenium in general.
Then there should be an explanation on how automation frameworks can avoid being detected by websites with anti-bot services.
Key things that Selenium frameworks need to do in order to avoid getting detected:
HeadlessChrome
toChrome
in the User Agent String.user_data_dir
, make sure that the folder is never used with non-UC-Mode Chrome.When all preventative measures are done correctly, Selenium should be able to enter websites appearing human:
Here are some existing examples that use
--uc
mode:Here's a raw driver example:
The text was updated successfully, but these errors were encountered: