Здравствуйте! Делаю программу с модулем selenium, которая спрашивает у пользователя логин и пароль от VK, затем переходит в браузер Chrom(driver), вводит данные на странице в VK, нажимает кнопку "ВХОД" и всё! НО, выдаёт ошибку (ниже ошибки)!
\\========================================\\
\\ Windows Python 3.7 модули - tkinter, selenium \\
\\======================================= \\
..........................................................................................................................................................................................................
================================================================================================
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py", line 1883, in __call__
return self.func(*args)
File "D:/python/VK.py", line 18, in <lambda>
button_enter = Button(text = "Войти!", command = lambda: Человек())
File "D:/python/VK.py", line 29, in Человек
elem.send_keys(log_lodin)
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 478, in send_keys
{'text': "".join(keys_to_typing(value)),
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\utils.py", line 150, in keys_to_typing
for i in range(len(val)):
TypeError: object of type 'Entry' has no len()
..........................................................................................................................................................................................................
================================================================================================
\\========================================\\
\\ Windows Python 3.7 модули - tkinter, selenium \\
\\======================================= \\
..........................................................................................................................................................................................................
================================================================================================
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py", line 1883, in __call__
return self.func(*args)
File "D:/python/VK.py", line 18, in <lambda>
button_enter = Button(text = "Войти!", command = lambda: Человек())
File "D:/python/VK.py", line 29, in Человек
elem.send_keys(log_lodin)
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 478, in send_keys
{'text': "".join(keys_to_typing(value)),
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\utils.py", line 150, in keys_to_typing
for i in range(len(val)):
TypeError: object of type 'Entry' has no len()
..........................................................................................................................................................................................................
================================================================================================
Python:
from tkinter import *
from selenium import webdriver
root = Tk()
root.geometry("300x500")
root.title("Войти в систему")
def поле():
log = Label(text = "Войдите в систему!")
log_log = Label(text = "Введите ваш логин:")
log_lodin = Entry()
log_password = Label(text = "Введите ваш пароль:")
log_password0 = Entry(show ="*")
button_enter = Button(text = "Войти!", command = lambda: Человек())
log.pack()
log_log.pack()
log_lodin.pack()
log_password.pack()
log_password0.pack()
button_enter.pack()
def Человек():
driver = webdriver.Chrome()
driver.get("https://vk.com/")
elem = driver.find_element_by_css_selector("#index_email")
elem.send_keys(log_lodin)
elem = driver.find_element_by_css_selector("#index_pass")
elem.send_keys(log_password0)
elem = driver.find_element_by_id("index_login_button")
elem.click()
поле()
root.mainloop()