File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 33
44class GitHubTests (BaseCase ):
55
6- # Selenium can trigger GitHub's abuse detection mechanism:
7- # "You have triggered an abuse detection mechanism."
8- # "Please wait a few minutes before you try again."
9- # To avoid this, slow_click() is being used to
10- # slow down Selenium actions.
11-
126 def test_github (self ):
7+ # Selenium can trigger GitHub's anti-automation system:
8+ # "You have triggered an abuse detection mechanism."
9+ # "Please wait a few minutes before you try again."
10+ # To avoid this automation blocker, two steps are being taken:
11+ # 1. self.slow_click() is being used to slow down Selenium actions.
12+ # 2. The browser's User Agent is modified to avoid Selenium-detection
13+ # when running in headless mode on Chrome.
14+ if self .browser == "chrome" and self .headless :
15+ self .driver .quit ()
16+ self .get_new_driver (
17+ agent = """Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) """
18+ """AppleWebKit/537.36 (KHTML, like Gecko) """
19+ """Chrome/75.0.3770.100 Safari/537.36""" )
1320 self .open ("https://github.com/" )
1421 self .update_text ("input.header-search-input" , "SeleniumBase\n " )
1522 self .slow_click ('a[href="/seleniumbase/SeleniumBase"]' )
You can’t perform that action at this time.
0 commit comments