tdameritrade: Cannot find chromedriver

Python 3.7.1 Windows 10

When running the authentication, I get an error that chromedriver must be in PATH. I’ve verified that I can start chromedriver from a DOS prompt and also tried adding the path in python as shown below but it didn’t work either.

Beyond the instructions you gave, webdriver was not installed so I ran pip install selenium

and downloaded the chromedriver.exe from http://chromedriver.chromium.org/downloads

` from tdameritrade import auth os.environ[“PATH”] += os.pathsep + r’C:\Program Files\ChromeDriver’; auth.authentication(‘my_td_user_id’,‘http://localhost:8080’)

Traceback (most recent call last): File “C:\Python\Python37-32\lib\site-packages\selenium\webdriver\common\service.py”, line 76, in start stdin=PIPE) File “C:\Python\Python37-32\lib\subprocess.py”, line 769, in init restore_signals, start_new_session) File “C:\Python\Python37-32\lib\subprocess.py”, line 1172, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “<pyshell#26>”, line 1, in <module> auth.authentication(‘epatton6tos’,‘http://localhost:8080’) File “C:\Users\Eddie\Dropbox\Python\ThinkOrSwim\tdameritrade_tunkpaine\tdameritrade\auth_init_.py”, line 13, in authentication driver = webdriver.Chrome(chrome_driver_binary, chrome_options=options) File “C:\Python\Python37-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py”, line 73, in init self.service.start() File “C:\Python\Python37-32\lib\site-packages\selenium\webdriver\common\service.py”, line 83, in start os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: ‘chromedriver’ executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home `

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 38 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks for the hint. I think I’m getting a bit further now. Instead of downloaded the webdriver.exe, I installed webdriver_manager since it seemed more portable. pip install webdriver-manager And then in auth/__init__.py I added from webdriver_manager.chrome import ChromeDriverManager and replaced driver = webdriver.Chrome(ChromeDriverManager().install(), chrome_options=options) with driver = webdriver.Chrome(ChromeDriverManager().install()) Now a chrome window is created that gives me the page below image I’m not sure yet if the options.binary_location is needed. But at least I’m not getting the “chromedriver’ executable needs to be in PATH” error.

Ok, I was able to get the login screen to come up, but the program did not detect where I installed chromedriver, and I had to change it to get it to work this time. I am using openSUSE linux, and the chromedriver is installed in: /usr/lib64/chromium/chromedriver

The error that came through was this: selenium.common.exceptions.WebDriverException: Message: ‘chromedriver’ executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

I don’t know how to put that directory on my PATH permanently, as it is not in the default PATH. Here is my PATH:

$PATH bash: /home/george/bin:/usr/local/bin:/usr/bin:/bin

Here is what came up when I imported ‘which’ and tried it:

which(‘chromedriver’) or “/usr/local/bin/chromedriver” ‘/usr/local/bin/chromedriver’ which(‘chromedriver’)

So no response came back for the 2nd one, which(‘chromedriver’). I changed “/usr/local/bin/chromedriver” to “/usr/lib64/chromium/chromedriver” on line 33 of the init.py function, and that is how I got the appropriate web page to come up.

ONE MORE THING I FIGURED OUT - This may or may not be a common mistake, but it made it work for me in order to be able to get the authorization code.

When entering the command, you have to use the form: tdameritrade.auth.authentication(“EXAMPLE”,“https://127.0.0.1”)

and do NOT do it like this: tdameritrade.auth.authentication(“EXAMPLE@AMER.OAUTHAP”,“https://127.0.0.1”)

because the extension “@AMER.OAUTHAP” is already added in by the function written that Tim wrote in python. It can be a bit confusing because when you do it manually on the tdameritrade api pages, you have to add in that extension. But here the procedure is properly written, and so that extension is not necessary.

Thanks, Tim, for your work on this.