Skip to content

Commit c94e249

Browse files
committed
Update a test
1 parent 0ee06c5 commit c94e249

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

Diff for: examples/github_test.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33

44
class 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"]')

0 commit comments

Comments
 (0)