0

I am working on Python/Selenium, I need to download a chromedriver but unfortunately this does mean that I have to set some sort of a specific path for my chromedriver, when I send this project off to someone how do I make it so they don't have to redownload chromedriver?

Example -

driver = webdriver.Chrome(executable_path='C:\chromedriver.exe')

So how can I place the chromedriver or what can I do so the executable path doesn't have to be changed?

roganjosh
  • 12,594
  • 4
  • 29
  • 46
M G
  • 47
  • 1
  • 7
  • You could package the driver with your script and use an installer to install the driver into a standard location. – JeffC Oct 31 '20 at 15:31

1 Answers1

0

You need to delete the absolute path and use a relative one. For example, if you ship your script with chromedriver, and you have both files in the same directory, you can just add a reference to it as if it is in the root directory:

driver = webdriver.Chrome(executable_path='chromedriver.exe')

Or, you can create a folder called resources and hide your chromedriver exe there. In this case, your link would be 'resources/chromedriver.exe'.

Dharman
  • 30,962
  • 25
  • 85
  • 135