V
V
Vlad Saenko2020-12-13 18:18:32
Python
Vlad Saenko, 2020-12-13 18:18:32

Python selenium how to specify path relative to script?

I don't want to hardcode the absolute path, because I will compile to exe and of course it won't work for users.
driver = webdriver.Chrome(r"path\chromedriver.exe")
driver = webdriver.Chrome('../chromedriver.exe')
Googled these 2 options and none of them work.
ps if it's easier, circumstances forced me to work with python, I myself work with php

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SuckMyPython, 2020-12-13
@Domovik93

driver = webdriver.Chrome('folder\chromedriver.exe')
#or
driver = webdriver.Chrome(r'folder/chromedriver.exe')
#or
driver = webdriver.Chrome('chromedriver.exe')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question