Skip to content
18 changes: 11 additions & 7 deletions sites/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def login(self):
WebDriverWait(self.browser, 10).until(EC.presence_of_element_located((By.XPATH, '//input[@id="username"]')))

self.fill_and_authenticate()

act_uname = WebDriverWait(self.browser, 10).until(EC.presence_of_element_located((By.XPATH, '//span[@data-test="accountUserName"]')))
time.sleep(1)
if "sign in" in act_uname.text.lower():
Expand All @@ -127,13 +127,17 @@ def fill_and_authenticate(self):
# slowly enters username and password with random waits between each character

if self.browser.find_elements_by_id('username'):
for key in settings.target_user:
self.browser.find_element_by_xpath('//input[@id="username"]').send_keys(key)
time.sleep(random.uniform(0.5, 1.5))
# for key in settings.target_user:
# self.browser.find_element_by_xpath('//input[@id="username"]').send_keys(key)
# time.sleep(random.uniform(0.5, 1.5))

self.browser.find_element_by_xpath('//input[@id="username"]').send_keys(settings.target_user)

for key in settings.target_pass:
self.browser.find_element_by_xpath('//input[@id="password"]').send_keys(key)
time.sleep(random.uniform(0.5, 1.5))
# for key in settings.target_pass:
# self.browser.find_element_by_xpath('//input[@id="password"]').send_keys(key)
# time.sleep(random.uniform(0.5, 1.5))

self.browser.find_element_by_xpath('//input[@id="password"]').send_keys(settings.target_pass)

loginBtn = wait(self.browser, self.TIMEOUT_LONG).until(
EC.presence_of_element_located((By.XPATH,'//button[@id="login"]'))
Expand Down