在pycharm中使用selenium

为在pycharm中使用selenium,需要按照以下步骤按照所需工具。

1、安装pychon

2、安装pycharm

3、在pycharm中配置pychon解释器地址。

4、在pycharm中添加selenium。

5、下载安装Selenium web驱动器。例如我的Chrome浏览器版本是 68.0.3440.106(正式版本) (64 位),那么需要下载对应的

ChromeDriver版本,例如如下的对应关系:
----------ChromeDriver v2.41 (2018-07-27)----------
Supports Chrome v67-69
Resolved issue 2458: Chromedriver fails to start with whitelisted-ips option [[Pri-1]]
Resolved issue 2379: Returned capabilities should include remote debugging port [[Pri-2]]
Resolved issue 1005: driver.manage().window().getSize() is not implemented on Android [[Pri-2]]
Resolved issue 2474: desktop launcher error messages are not readable by users [[Pri-]]
Resolved issue 2496: Fail fast when not able to start binary [[Pri-]]
Resolved issue 1990: Close Window return value does not conform with spec [[Pri-]]

----------ChromeDriver v2.40 (2018-06-07)----------
Supports Chrome v66-68
Resolved issue 2446: Regression: Chromedriver 2.39 hangs on open when user-data-dir is specified and exists [[Pri-1]]
Resolved issue  779: Make ChromeDriver able to listen on requests from IPv6. [[Pri-1]]
Resolved issue 2339: Chromedriver couldn't find the Android file using valid file path [[Pri-2]]
Resolved issue 2307: /session/:sessionId/send_command and /session/:sessionId/send_command_and_get_result should be changed to be proper extension commands [[Pri-]]


------------------------------

那么我下载需要的驱动器版本是

ChromeDriver v2.41 

下载地址是:http://chromedriver.storage.googleapis.com/index.html?path=2.41/

然后把下载后的这个chromedriver.exe文件,放置到pycharm的编译器地址目录中即可,通常在Scripts目录下。

其他驱动器下载,可在https://docs.seleniumhq.org/download/中查找。

你可能感兴趣的:(爬虫,pychon,pycharm)