Я пытался использовать код python для автоматической публикации контента в определенной группе, но получаю ошибку ниже. Я не очень хорошо разбираюсь в python, но исправил большинство ошибок компиляции. Пожалуйста, помогите мне исправить указанные ниже ошибки. Я использую python 3
Это код, который я использую для публикации в facebook
from datetime import datetime
from time import sleep
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
username = raw_input('Enter your username: ')
password = raw_input('Enter your password: ')
number_time_post = int(input('Enter the number times post: '))
id_target = int(input('Enter the target ID (page, group, user): '))
content = 'Testing content'
chrome_options = Options()
chrome_options.add_experimental_option(
"prefs", {'profile.managed_default_content_settings.javascript': 2}
)
driver = webdriver.Chrome('chromedriver', chrome_options=chrome_options)
driver.get("https://m.facebook.com/")
print("Opened facebook")
username_box = driver.find_element_by_id('m_login_email')
username_box.send_keys(username)
print("Email Id entered")
password_box = driver.find_element_by_id('m_login_password')
password_box.send_keys(password)
print("Password entered")
login_box = driver.find_element_by_id('u_0_5')
sleep(10)
login_box.click()
try:
if driver.find_element_by_id('m_login_email') or \
driver.find_element_by_id('m_login_password'):
print("The username or password is incorrect")
exit(1)
except Exception:
pass
count = 0
print('Index\t Duration')
start_process = datetime.now()
while number_time_post > 0:
start = datetime.now()
count += 1
driver.get(
"https://m.facebook.com/{}".format(id_target)
)
message_box = None
try:
message_box = driver.find_element_by_name('xc_message')
except Exception:
message_box = driver.find_element_by_id('u_0_0')
finally:
if not message_box:
print('Something went wrong. Please check it again')
exit(1)
message_box.send_keys(
content + ' \n.\n.\n.\n.\n.\n' + str(datetime.now().timestamp())
)
post_btn = driver.find_element_by_name('view_post')
sleep(1)
post_btn.click()
end = datetime.now()
duration = end - start
print("{}\t {}".format(count, duration))
number_time_post -= 1
end_process = datetime.now()
print('Total\t {}'.format(end_process - start_process))
driver.close()
Пожалуйста, укажите ошибку ниже
C:\Users\uday\Downloads\facebook-auto-post-master>python run.py
Enter your username: 11
Enter your password: 11
Enter the number times post: 11
Enter the target ID (page, group, user): 11
DevTools listening on ws://127.0.0.1:65149/devtools/browser/167f42ea-0a1f-4c63-80da-5ef4f720d7b6
Opened facebook
Email Id entered
Password entered
Traceback (most recent call last):
File "run.py", line 34, in <module>
login_box.click()
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: chrome=83.0.4103.116)