S
S
Soul12021-04-12 01:17:06
Python
Soul1, 2021-04-12 01:17:06

How to log in to VK using Selenium + Python?

Script code, login and password I insert

from selenium import webdriver


def main():
    driver = webdriver.Chrome('operadriver.exe')
    driver.get('https://vk.com/login')
    s_username = driver.find_element_by_name('email')
    s_password = driver.find_element_by_name('pass')
    s_continue = driver.find_element_by_id('login_button')
    s_username.send_keys('логин/почта')
    s_password.send_keys('пароль')
    s_continue.click()


if __name__ == '__main__':
    main()


Code snippet of the login page

607375105075f836962983.png

Gives an error selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
As I understand it, it says that the element is not interactive, it cannot be clicked. And in the page code, only the registration button really has onclick, the login button does not have this.
What to do, how to be?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Kuts, 2021-04-12
@fox_12

Push programmatically by executing javascript as an option.

driver.execute_script("document.getElementById('index_login_button').click()")

A
aab137, 2021-08-17
@aab137

And Google, meanwhile, to help https://github.com/xkord/vk_login_selenium

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question