Bonjour,

J'ai trouvé un code sur internet (avec la librairy Selenium) pour simuler un click sur un site web. Cependant, à l’exécution du code, je tombe sur un exception
"selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home"

après recherche j'ai essayé de rajouter:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
options.binary_location = "C:\Chemin\chromedriver_win32\chromedriver.exe"
Mais je tombe toujours sur une erreur
Si je passe avec firefox ca me fait la même chose

Avez-vous une idée ?

Bonne journée


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
from selenium import webdriver
import time
 
options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument("--test-type")
options.binary_location = "/usr/bin/chromium"
driver = webdriver.Chrome(chrome_options=options)
driver.get('http://codepad.org')
 
# click radio button
python_button = driver.find_elements_by_xpath("//input[@name='lang' and @value='Python']")[0]
python_button.click()
 
# type text
text_area = driver.find_element_by_id('textarea')
text_area.send_keys("print('Hello World')")
 
# click submit button
submit_button = driver.find_elements_by_xpath('//*[@id="editor"]/table/tbody/tr[3]/td/table/tbody/tr/td/div/table/tbody/tr/td[3]/input')[0]
submit_button.click()
code made in https://pythonspot.com/selenium-click-button/