I am having this problem in Whatsapp bot sending auto message in python.
Code trial:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
import time
message = "this is message"
amount = 50
delay = 0.1
contact = "person to message"
options = webdriver.ChromeOptions()
options.add_argument('user-data-dir=C:\\Chrome_Profile')
driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe", options=options)
driver.get('https://web.whatsapp.com/')
#driver.minimize_window()
time.sleep(20)
name_list = []
#//*[@id="pane-side"]/div[1]/div/div/div[11]/div/div/div/div[2]
#//*[@id="pane-side"]/div[1]/div/div/div[11]/div/div/div/div[2]/div[1]/div[1]/span
for i in range(1, 15):
info = driver.find_element_by_xpath(f'//*[@id="pane-side"]/div[1]/div/div/div[{i}]' + '/div/div/div/div[2]/div[1]/div[1]/span')
name_list.append(info.text)
to_click = name_list.index(contact) + 1
driver.find_element_by_xpath(f'//*[@id="pane-side"]/div[1]/div/div/div[{to_click}]').click()
time.sleep(2)
#//*[@id="main"]/footer/div[1]/div/span[2]/div/div[2]/div[1]/div/div[1]
for i in range(amount):
# Searching for text box
text_box = driver.find_element_by_xpath('//*[@id="main"]/footer/div[1]/div/span[2]/div/div[2]/div[1]/div/div[1]')
text_box.send_keys(message)
text_box.send_keys(Keys.ENTER)
time.sleep(delay)
Error:
Traceback (most recent call last):
File "c:\Users\Monster\OneDrive\Masaüstü\UserName\SPAMBOT PYTHON\spambot.py", line 14, in <module>
driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe", options=options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: WebDriver.__init__() got an unexpected keyword argument 'executable_path'
So far, I tried Service library instead of driver keyword but no solution.Also the same code was working until about a few months ago with no change. But when I opened it today nothing changed my code didn't work

As mentioned in my earlier solution, https://stackoverflow.com/a/76550727/7058266, this is due to changes in
selenium4.10.0: https://github.com/SeleniumHQ/selenium/commit/9f5801c82fb3be3d5850707c46c3f8176e3ccd8eNote that
executable_pathwas removed.If you want to pass in an
executable_path, you'll have to use theservicearg now.