forked from thepycoach/automation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66b83d7
commit 8e01f46
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import undetected_chromedriver as uc | ||
from twocaptcha import TwoCaptcha | ||
import time | ||
|
||
web = "https://www.google.com/recaptcha/api2/demo" | ||
driver = uc.Chrome() | ||
driver.get(web) | ||
|
||
# Site Key | ||
sitekey = driver.find_element(by='id', value='recaptcha-demo').get_attribute('data-sitekey') | ||
print(sitekey) | ||
|
||
api_key = "YOUR_API" | ||
solver = TwoCaptcha(api_key) | ||
print("Solving captcha...") | ||
response = solver.recaptcha( | ||
sitekey=sitekey, | ||
url=web, | ||
) | ||
|
||
print(f'Captcha Key: {response["code"]}') | ||
|
||
# Send Captcha Key to form | ||
driver.execute_script("document.getElementById('g-recaptcha-response').value = '{}';".format(response["code"])) | ||
|
||
# Click Submit | ||
driver.find_element(by='xpath', value='//*[@id="recaptcha-demo-submit"]').click() | ||
|
||
time.sleep(5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from undetected_chromedriver import Chrome | ||
import time | ||
|
||
# create a new instance of Chrome | ||
chrome = Chrome() | ||
|
||
# navigate to the website | ||
chrome.get("https://example.com") | ||
|
||
time.sleep(10) | ||
# close the browser | ||
chrome.close() |