Я пытаюсь создать бот WhatsApp с python.
В терминале появляется следующая ошибка:
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: '.chromedriver.exe' executable needs to be in PATH.
Please see https://sites.google.com/a/chromium.org/chromedriver/home
Но при запуске .exe в том же каталоге, что и мой python script
Какой идентификатор?
Где код:
from selenium import webdriver
import time
class WhatsappBot:
def __init__(self):
self.mensagem = "BOT TEST"
self.grupos = ["APS jogo", "Mine"]
options = webdriver.ChromeOptions()
options.add_argument('land=pt-br')
self.driver = webdriver.Chrome(executable_path=r'.chromedriver.exe')
def EnviarMensagens(self):
self.driver.get('https://web.whatsapp.com/')
time.sleep(30)
for grupo in self.grupos:
grupo = self.driver.find_element_by_xpath(f"//span[@title='{grupo}']")
time.sleep(3)
grupo.click()
chatBox= self.driver.find_element_by_class_name('_1Plpp')
time.sleep(3)
chatBox.click()
chatBox.send_keys(self.mensagem)
botaoEnviar = self.driver.find_element_by_xpath("//span[data-icon='send']")
time.sleep(3)
botaoEnviar.click()
time.sleep(3)
bot = WhatsappBot()
bot.EnviarMensagens()