0

Can someone please explain and help me fix this problem? I'm trying to automate the gym training in torn (browser game) and after some errors and debugging, I'm stuck again... I'll post both the error message and the code.

from selenium import webdriver

driver = webdriver.Chrome(executable_path='d:/Users/Usuario/Desktop/Python Training/drivers/81/chromedriver')
driver.get('https://www.torn.com/gym.php')
xpath = '//*[@id="gymroot"]/div/div[2]/div/ul/li[1]/div[2]/div[2]/button'
btn = driver.find_element_by_xpath(xpath)
btn.click()

Error:

Traceback (most recent call last):
  File "d:\Users\Usuario\Desktop\Python Training\projects\tornGymTrain.py", line 4, in <module>
    driver = webdriver.Chrome(executable_path='d:/Users/Usuario/Desktop/Python Training/drivers/81/chromedriver')
  File "C:\Users\Usuario\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in __init__
    RemoteWebDriver.__init__(
  File "C:\Users\Usuario\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\Usuario\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\Usuario\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Usuario\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary
wjandrea
  • 28,235
  • 9
  • 60
  • 81
Unix
  • 1
  • 1
  • Have you already seen this? [Selenium gives “selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary” on Mac](https://stackoverflow.com/q/46026987/4518341) – wjandrea May 10 '20 at 17:45
  • you need to add ```.exe``` to the chromedriver's path – Hozayfa El Rifai May 10 '20 at 17:45
  • No, because I'm not using mac nor linux. And I tried with .exe too and i get the same thing. – Unix May 10 '20 at 17:57

1 Answers1

0

This is because you have not given the executable path correctly.

Update the path with .exe file. You have just stopped at the path location.

Vemula Dheeraj
  • 64
  • 1
  • 11