Allow user to log in manually

master
Dan Howe 5 years ago
parent 63be3fbea3
commit 1517ab6084

@ -18,12 +18,12 @@ from selenium.common.exceptions import (NoSuchElementException,
WebDriverException)
CAM_ID = 0
USERNAME = ''
PASSWORD = ''
URL = 'https://camera.uwatchit.com.au/UWatchitWebV2/User/LiveView#'
OUTPUT_DIR = 'images'
TIMEZONE = 'Australia/Sydney'
WAIT_TIME = 0.1
username = ''
password = ''
def start_session():
@ -52,15 +52,25 @@ def login(driver):
driver.get(URL)
# Get login fields
usr = driver.find_element_by_id('UserName')
pss = driver.find_element_by_id('Password')
btn = driver.find_element_by_id('submitlogin')
# Input login details
usr.send_keys(USERNAME)
pss.send_keys(PASSWORD)
btn.click()
# Login automatically if details provided
if username and password:
# Get login fields
usr = driver.find_element_by_id('UserName')
pss = driver.find_element_by_id('Password')
btn = driver.find_element_by_id('submitlogin')
# Input login details
usr.send_keys(username)
pss.send_keys(password)
btn.click()
else:
# Wait for user to log in manually
while True:
try:
print(driver.find_element_by_id('UserName'))
time.sleep(1)
except NoSuchElementException:
break
# Extract cookies
session = requests.Session()

Loading…
Cancel
Save