mirror of
https://github.com/inAudible-NG/audible-activator.git
synced 2024-11-18 03:18:57 +01:00
Update webdriver.Chrome() and webdriver.find_element() syntax
selenium.webdriver.Chrome() no longer supports passing executable_path directly. It's now passed via a service. Also, update deprecated calls to find_element_by_id() to the new find_element() method.
This commit is contained in:
parent
79e2cea3ca
commit
1cb12b8212
@ -54,7 +54,7 @@ pip install --user selenium
|
|||||||
```
|
```
|
||||||
|
|
||||||
Download and extract the correct ChromeDriver zip file [from
|
Download and extract the correct ChromeDriver zip file [from
|
||||||
here](https://sites.google.com/a/chromium.org/chromedriver/downloads) to this
|
here](https://googlechromelabs.github.io/chrome-for-testing/) to this
|
||||||
folder.
|
folder.
|
||||||
|
|
||||||
Download Google Chrome from https://www.google.com/chrome/ and install it on
|
Download Google Chrome from https://www.google.com/chrome/ and install it on
|
||||||
|
@ -10,6 +10,8 @@ import binascii
|
|||||||
import requests
|
import requests
|
||||||
from getpass import getpass
|
from getpass import getpass
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
|
from selenium.webdriver.chrome.service import Service
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
PY3 = sys.version_info[0] == 3
|
PY3 = sys.version_info[0] == 3
|
||||||
@ -88,8 +90,8 @@ def fetch_activation_bytes(username, password, options):
|
|||||||
chromedriver_path = "./chromedriver"
|
chromedriver_path = "./chromedriver"
|
||||||
|
|
||||||
|
|
||||||
driver = webdriver.Chrome(options=opts,
|
service = Service(executable_path=chromedriver_path)
|
||||||
executable_path=chromedriver_path)
|
driver = webdriver.Chrome(service=service, options=opts)
|
||||||
|
|
||||||
query_string = urlencode(payload)
|
query_string = urlencode(payload)
|
||||||
url = login_url + query_string
|
url = login_url + query_string
|
||||||
@ -99,9 +101,9 @@ def fetch_activation_bytes(username, password, options):
|
|||||||
print("[!] Running in DEBUG mode. You will need to login in a semi-automatic way, wait for the login screen to show up ;)")
|
print("[!] Running in DEBUG mode. You will need to login in a semi-automatic way, wait for the login screen to show up ;)")
|
||||||
time.sleep(32)
|
time.sleep(32)
|
||||||
else:
|
else:
|
||||||
search_box = driver.find_element_by_id('ap_email')
|
search_box = driver.find_element(By.ID, 'ap_email')
|
||||||
search_box.send_keys(username)
|
search_box.send_keys(username)
|
||||||
search_box = driver.find_element_by_id('ap_password')
|
search_box = driver.find_element(By.ID, 'ap_password')
|
||||||
search_box.send_keys(password)
|
search_box.send_keys(password)
|
||||||
search_box.submit()
|
search_box.submit()
|
||||||
time.sleep(2) # give the page some time to load
|
time.sleep(2) # give the page some time to load
|
||||||
|
Loading…
Reference in New Issue
Block a user