webdriver.Chrome参数解释
2020-04-01 18:35
387 查看
通过源码看解释
最直接最不讲道理的方式就是看源码,使用之前一定要学会看说明书。
打算使用jupyter演示的,但是jupyter不支持看源码,所以使用Pycharm吧。
from selenium import webdriver Broswer = webdriver.Chrome(executable_path="chromedriver", port=0, options=None, service_args=None, desired_capabilities=None, service_log_path=None, chrome_options=None, keep_alive=True) print(webdriver.Chrome.__doc__) """ Controls the ChromeDriver and allows you to drive the browser. You will need to download the ChromeDriver executable from http://chromedriver.storage.googleapis.com/index.html """ print(webdriver.Chrome.__init__.__doc__) """ Creates a new instance of the chrome driver. Starts the service and then creates new instance of chrome driver. :Args: - executable_path - path to the executable. If the default is used it assumes the executable is in the $PATH - port - port you would like the service to run, if left as 0, a free port will be found. - options - this takes an instance of ChromeOptions - service_args - List of args to pass to the driver service - desired_capabilities - Dictionary object with non-browser specific capabilities only, such as "proxy" or "loggingPref". - service_log_path - Where to log information from the driver. - chrome_options - Deprecated argument for options - keep_alive - Whether to configure ChromeRemoteConnection to use HTTP keep-alive. """
Chrome Doc解释: 控制ChromeDriver并允许您驱动浏览器。你需要从
http://chromedriver.storage.googleapis.com/index.html下载ChromeDriver的可执行文件。没有下ChromeDriver的小伙伴根据自己浏览器版本下载相应的ChromeDriver版本,两者版本关系ChromeDriver版本>=Chrome版本。
参数解释:
-
executable_path - 可执行文件的路径。如果使用默认值,则假定可执行文件位于$PATH中。
-
port- 你希望服务运行的端口,如果为0,使用空闲端口。
-
options - 这是ChromeOptions的一个实例
-
service_args - 要传递给驱动程序服务的args列表
-
desired_capabilities -仅具有非浏览器特定功能的字典对象,例如“proxy”或“loggingPref”。
-
service_log_path - 记录来自驱动程序的信息存放路径。
-
chrome_options - chrome选项。
-
keep_alive -是否配置ChromeRemoteConnection使用HTTP keep-alive。
其中
options和
chrome_options:使用options代替chrome_options。
if chrome_options: warnings.warn('use options instead of chrome_options', DeprecationWarning, stacklevel=2) options = chrome_options
并且告知此警告被弃用
关于
executable_path解释:value是ChromeDriver.exe路径。
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- selenium webdriver 启动三大浏览器Firefox,Chrome,IE
- webdriver.Chrome()提示'chromedriver' executable needs to be in PATH.
- selenium.common.exceptions.WebDriverException:Message:'chromedriver' executable needs to be in PATH
- selenium webdriver 使用Chrome 浏览器
- Selenium_webdriver对 chrome driver的调用
- python+selenium+webdriver+chromedriver
- ubuntu 自动化测试(selenium webdriver+chrome)结合Xvfb
- Selenium2(WebDriver)总结(二)---Firefox的firebug插件参数设置(补充)
- Selenium2中,WebDriverWait中expected_conditions.element_to_be_clickable()参数传递
- selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH
- 爬虫Chrome谷歌浏览器的驱动webdriver下载
- UI自动化启动浏览器问题:cannot find Chrome binary和webdriver可以打开浏览器,但是无法输入网址...
- selenium webdriver 启动三大浏览器Firefox Chrome IE
- webdriver.Chrome()提示--ignore-certificate-errors
- Ubuntu 16.04 selenium webdriver 启动三大浏览器Firefox,Chrome,IE
- webdriver(Chrome)下载地址
- 百度搜索_Selenium WebDriver 环境搭建和错误调试_chromedriver_win32必须下载否则无法测试chrome
- ruby webdriver 启动chrome浏览器的一些小技巧
- Windows下配置Chrome WebDriver
- webdriver.Chrome.set_network_conditions:Chrome网络仿真设置。