Элемент кнопки запроса на добавление в друзья в Facebook не отображается - PullRequest
0 голосов
/ 02 сентября 2018

Element не отображается

Попытка автоматической отправки запросов на добавление в друзья на Facebook с использованием Python и Selenium

button code...

chrome_options = webdriver.ChromeOptions()
prefs = {"profile.default_content_setting_values.notifications" : 2}
chrome_options.add_experimental_option("prefs",prefs)
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get('https://www.facebook.com/friends/requests/')
print("Opened facebook...")
email = driver.find_element_by_xpath("//input[@id='email' and @name='email']")
email.send_keys('')
password = driver.find_element_by_xpath("//input[@id='pass' and @name='pass']")
password.send_keys('')
button = driver.find_element_by_xpath("//button[@id='loginbutton' and @name='login']")
button.click()
time.sleep(5)
send_friend_request = driver.find_element_by_xpath("//button[@type='button' and contains(@class,'FriendRequestAdd addButton')]")
send_friend_request.click()

Код работает до входа в систему, time.sleep(5) и при запуске следующих кодов

send_friend_request = driver.find_element_by_xpath("//button[@type='button' and contains(@class,'FriendRequestAdd addButton')]")

Возвращает ошибку как

Элемент не виден

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...