前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Selenium Webdriver 3.X源码分析之webdriver.py(三)

Selenium Webdriver 3.X源码分析之webdriver.py(三)

作者头像
苦叶子
发布2019-11-12 14:28:03
8280
发布2019-11-12 14:28:03
举报
文章被收录于专栏:开源优测开源优测
> Selenium Webdriver 3.X源码分析系列第18篇,该系列原则上会将整个源码分享一遍

本文主要讲解,webdriver.py模块中WebDriver类。

我们先看一下WebDriver类的初始化函数: __init__函数

下面对__init__函数的功能和参数进行说明:

功能

创建一个使用webdriver wire协议命令的webdriver驱动实例。

参数

command_executor: 表示远程服务器url字符串或自定义的remote_connection.RemoteConnection对象。默认值为:http://127.0.0.1:4444/wd/hub

desired_capabilities: 当请求启动浏览器时所需的参数信息,字典类型

broser_profile: 可选参数,类型为:selenium.webdriver.firefox.firefox_profile.FirefoxProfile对象,仅用于firefox浏览器

proxy: 可选参数,类型为:selenium.webdriver.common.proxy.Proxy对象,浏览器会话启动时可能使用的代理设置

keep_alive: 用于配置remote_connection.RemoteConnection是否使用HTTP keep-alive选项,默认为False

file_detector: 在实例化期间传递一个自定义file detecotr对象,如果没给该参数,则默认使用LocalFileDetector()

options:传入一个options.Options实例

__init__方法是必须掌握的,因为该方法决定了你如何初始化你的webdriver对象,以及你要在什么样的环境下运行你的测试代码,需要对每一个参数有比较深刻的理解,对于具体参数所涉及的一些对象,请参见下面之前各源码分析的文章。

  1. Selenium3.X源码分析之开始,走上人生巅峰
  2. Selenium3.X源码分析之异常源码
  3. Selenium Webdriver 3.X源码分析之核心目录结构
  4. Selenium Webdriver 3.X源码分析之核心代码common
  5. Selenium Webdriver 3.X源码分析之ActionChains
  6. Selenium Webdriver 3.X源码分析之alert.py
  7. Selenium Webdriver 3.X源码分析之DesiredCapabilities分布式测试解决方案
  8. Selenium Webdriver 3.X源码分析之定位方式和键盘定义
  9. Selenium Webdriver 3.X源码分析之Proxy.py代理能力
  10. Selenium Webdriver 3.X源码分析之移动触摸动作touch_actions.py
  11. Selenium Webdriver 3.X源码分析之核心remote package
  12. Selenium Webdriver 3.X源码分析之command.py
  13. Selenium Webdriver 3.X源码分析之remote_connection.py
  14. Selenium Webdriver 3.X源码分析之errorhandler.py
  15. Selenium Webdriver 3.X源码分析之switch_to.py
  16. Selenium Webdriver 3.X源码分析之webdriver.py(一)
  17. Selenium Webdriver 3.X源码分析之webdriver.py(二)
本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2019-10-31,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 开源优测 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档