Написал скриптик авторизации "вконтакте" и хочу через терминал передать сообщением инпутом.
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.keys import Keys
login =
password = ""
message = str(input('Enter: '))
class Bot:
def __init__(self):
self.driver = webdriver.Firefox()
self.navigate()
def navigate(self):
self.driver.get("https://vk.com/")
field_number = self.driver.find_element_by_xpath('//input[@id="index_email"]')
field_number.send_keys(login)
field_password = self.driver.find_element_by_xpath('//input[@id="index_pass"]')
field_password.send_keys(password)
button = self.driver.find_element_by_xpath('//button[@id="index_login_button"]')
button.click()
sleep(1.5)
self.driver.get("https://vk.com/im")
a_message = self.driver.find_element_by_xpath('//li[@class="nim-dialog _im_dialog _im_dialog_22581127 nim-dialog_unread nim-dialog_classic"]')
a_message.click()
sleep(1.5)
send_message = self.driver.find_element_by_xpath('//div[@id="im_editable0"]')
send_message.send_keys(message)
send_message.send_keys(Keys.RETURN)
def main():
b = Bot()
if __name__=="__main__":
main()
Выдает ошибку:
Enter: Hello
Traceback (most recent call last):
File "vk.py", line 6, in <module>
message = str(input('Enter: '))
File "<string>", line 1, in <module>
NameError: name 'Hello' is not defined