SoFunction
Updated on 2024-11-20

Selenium Exception Handling in Python

When crawling Taobao product information, I encountered this problem when using selenium to simulate a browser for crawling:

:Message:'chromedriver' executable needs to be in Path

Details are shown below:

This error is because the chromedriver is not configured, how can I configure it? (I'm using chrome)

  • 1. open chrome and type "chrome://version/" to check the chrome version as shown in the picture my is 63

  • 2. Visit this website/ Then select the appropriate version of driver

for example

Click on it to view its corresponding version number as follows:

If it matches, you can download it, download it to the location you specified and configure it.

  • 3. The configuration is as follows:

(The exact path depends on where you download and save)

  • 4. This time to run the basic can be successful!

Unfortunately, though, the version of the driver I blindly downloaded the first time was incorrect, so it threw the following error ConnectionResetError:The host forced the closure of an existing connection

So I re-downloaded a matching driver version and ok!

This is the end of this article on Python to resolve selenium exceptions. I hope it will be helpful for your learning and I hope you will support me more.