Selenium3 Python WebDriver API源码探析(2):Selenium包目录结构、模块功能概述

Python+Selenium 自动化测试 2. Webdriver API介绍 目录 一 Webdriver介绍 二 webdriver实现的原理 三 API介绍 Webdriver 元素的查找的八种方式 find_element_by_id() 源码 find_element_by_name() 源码 find_element_by_link_text() 源码 find_element_by_partial_link_text() 源码 find... 阅读详情

Selenium 包结构概述

Selenium 包结构如下:

selenium
├─common
└─webdriver
    ├─android
    ├─blackberry
    ├─chrome
    ├─common
    │  ├─actions
    │  └─html5
    ├─edge
    ├─firefox
    ├─ie
    ├─opera
    ├─phantomjs
    ├─remote
    ├─safari
    ├─support
    └─webkitgtk
  • common包:仅包含exceptions.py模块,定义了异常类。
  • webdriver包:核心API
    • remote包定义了核心基类,其中webdriver.py和webelement.py是API中的关键,定义了浏览器的通用操作方法和元素的处理方法。
    • common包定义键盘事件、鼠标事件、触屏事件、浏览器参数设置、元素定位、代理等基础行为处理。
    • support包定义了事件处理、事件触发、UI、超时处理等基类。
    • android、backberry、chrome、edge、firefox、ie、opera、phantomjs、safari、 webkitgtk等子包为对不同浏览器的支持。

Selenium 包、模块结构及功能详细说明

│  __init__.py # 定义__version__属性
│
├─common #一级子包
│  │  exceptions.py # 定义异常类
│  │  __init__.py # 导入异常类
│
├─webdriver # 一级子包,核心API包
│  │  __init__.py # 命名空间整合,定义了各浏览器API的快捷接口
│  │
│  ├─android # 二级子包,Android端webview支持
│  │  │  webdriver.py  # 使用WebView创建Selendroid实例
│  │  │  __init__.py
│  │
│  ├─blackberry # 二级子包,黑莓手机浏览器支持
│  │  │  webdriver.py
│  │  │  __init__.py
│  │
│  ├─chrome # 二级子包,Chrome浏览器支持
│  │  │  options.py
│  │  │  remote_connection.py
│  │  │  service.py
│  │  │  webdriver.py
│  │  │  __init__.py
│  │
│  ├─common # 二级子包,定义了键盘事件、鼠标事件、触屏事件、浏览器参数设置、元素定位、代理等基础行为处理
│  │  │  action_chains.py # 定义了底层的自动化交互的方法,如鼠标移动、鼠标按键等
│  │  │  alert.py # 定义了alert弹出的处理方法
│  │  │  by.py # 仅有一个By类作为命名空间,定义了8个类变量,即元素定位策略集合
│  │  │  desired_capabilities.py # 定义和实现了不同浏览器的DesiredCapabilities
│  │  │  keys.py # 仅有一个Keys类作为命名空间,定义了各种功能键的Unicode编码
│  │  │  proxy.py # 定义了各类代理的实现
│  │  │  service.py # 定义了连接、关闭等基础服务
│  │  │  touch_actions.py # 定义了移动设备的一些基础操作
│  │  │  utils.py # 定义了一些的辅助函数
│  │  │  __init__.py
│  │  │
│  │  ├─actions # 三级子包,移动端各类actions支持
│  │  │  │  action_builder.py # 定义了移动端动作构建类
│  │  │  │  input_device.py # 描述了输入设备动作的基本操作
│  │  │  │  interaction.py # 定义了交互、暂停的基类
│  │  │  │  key_actions.py # 定义了键盘事件处理
│  │  │  │  key_input.py # 定义了输入事件处理
│  │  │  │  mouse_button.py # 定义了鼠标按钮编码
│  │  │  │  pointer_actions.py # 定义了屏幕点击事件处理
│  │  │  │  pointer_input.py # 定义了屏幕输入事件处理
│  │  │  │  __init__.py
│  │  │
│  │  ├─html5 # 三级子包,HTML5支持
│  │  │  │  application_cache.py # 定义了应用缓存的状态编码和缓存状态的获取方法
│  │  │  │  __init__.py
│  │
│  ├─edge # 二级子包,edge浏览器支持
│  │  │  options.py
│  │  │  service.py
│  │  │  webdriver.py
│  │  │  __init__.py
│  │
│  ├─firefox # 二级子包,Firefox浏览器支持
│  │  │  extension_connection.py
│  │  │  firefox_binary.py
│  │  │  firefox_profile.py
│  │  │  options.py
│  │  │  remote_connection.py
│  │  │  service.py
│  │  │  webdriver.py
│  │  │  webdriver.xpi
│  │  │  webdriver_prefs.json
│  │  │  webelement.py
│  │  │  __init__.py
│  │
│  │  ├─amd64
│  │  │      x_ignore_nofocus.so
│  │  │
│  │  ├─x86
│  │  │      x_ignore_nofocus.so
│  │
│  ├─ie # 二级子包,IE浏览器支持
│  │  │  options.py
│  │  │  service.py
│  │  │  webdriver.py
│  │  │  __init__.py
│  │
│  ├─opera # 二级子包,Opera浏览器支持
│  │  │  options.py
│  │  │  webdriver.py
│  │  │  __init__.py
│  │
│  ├─phantomjs # 二级子包,phantomjs支持,不过phantomjs项目已经废弃了
│  │  │  service.py
│  │  │  webdriver.py
│  │  │  __init__.py
│  │
│  ├─remote # 二级子包,定义了selenium操作的核心基类。
│  │  │  command.py # 定义了各类标准WebDriver命令的常量
│  │  │  errorhandler.py # 定义了WebDriver的错误代码和异常处理
│  │  │  file_detector.py # 定义了文件检测类
│  │  │  getAttribute.js 
│  │  │  isDisplayed.js
│  │  │  mobile.py # 定义了移动端的连接和上下文管理
│  │  │  remote_connection.py
│  │  │  switch_to.py # 定义了iframe切换管理
│  │  │  utils.py # 定义了json文件、压缩文件操作函数
│  │  │  webdriver.py # 定义了WebDriver操作类
│  │  │  webelement.py # 定义了元素操作类
│  │  │  __init__.py
│  │
│  ├─safari # 二级子包,Safari浏览器支持
│  │  │  permissions.py
│  │  │  remote_connection.py
│  │  │  service.py
│  │  │  webdriver.py
│  │  │  __init__.py
│  │
│  ├─support # 二级子包,定义了事件处理、事件触发、UI、超时处理等基类
│  │  │  abstract_event_listener.py # 定义了事件监听器基类
│  │  │  color.py # 定义了颜色转换支持类、方法和常量
│  │  │  events.py # 命名空间整合,导入了AbstractEventListener类和EventFiringWebDriver类
│  │  │  event_firing_webdriver.py # 定义了webdriver和WebElement事件触发类
│  │  │  expected_conditions.py # 定义了浏览器各类操作实现的验证方法
│  │  │  select.py # 定义了select控件的操作方法
│  │  │  ui.py # 命名空间整合,导入Select和WebDriverWait类
│  │  │  wait.py # 定义了webdriver的超时机制
│  │  │  __init__.py
│  │  
│  ├─webkitgtk # 二级子包,webkitgtk支持
         │  options.py
         │  service.py
         │  webdriver.py
         │  __init__.py
selenium3源码解析Python篇(十六)-webdriver源码解析 此章为核心模块,内含对浏览器的各种操作!!! 目录结构如下: class WebDriver(object): 将命令通过WebDriver wire protocol协议发送到服务器 session_id: 由此webdriver启动和控制浏览器的会话id capabilities: 远端服务器以字典形式返回有效功能,并非所有服务器实现都将支持每种WebDriver功能。 因此,在描述用户请... 阅读详情

相关推荐

普中科技ESP8266-01s模块CWJAP:3 FAIL报错?手把手教你用AT+CWSAP指令搞定WiFi配置

本文详细解析了普中科技ESP8266-01s模块常见的CWJAP:3 FAIL报错问题,并提供了通过AT+CWSAP指令正确配置WiFi的实战解决方案。文章涵盖错误根源分析、硬件连接指南、AT指令详解及高级调试技巧,帮助开发者快速解决ESP8266-01s模块的WiFi配置难题。

weixin_42653691的博客 202

selenium webdrive使用

一、selenium浏览器驱动的下载与调用 1、安装三大浏览器驱动driver ①chrome的驱动chromedriver 下载地址: https://code.google.com/p/chromedriver/downloads/list http://chromedriver.storage.googleapis.com/index.html CNPM Binaries Mirror ②IE的驱动IEdriver 下载地址: NuGet Gallery | Selenium...

GMH的博客 5156

python爬虫入门教程(非常详细)

爬虫指的是一种自动化程序,能够模拟人类在互联网上的浏览行为,自动从互联网上抓取、预处理并保存所需要的信息。爬虫运行的过程一般是先制定规则(如指定要抓取的网址、要抓取的信息的类型等),紧接着获取该网址的HTML源代码,根据规则对源代码进行解析和抽取,最后进行处理和保存。爬虫在实际应用中广泛使用,如搜索引擎、大数据分析、交易数据采集等领域,都需要用到爬虫技术来实现信息的定向采集和处理。

工宗浩生财指南针 2万+

【2023全网最全最火】Selenium WebDriver教程(建议收藏)

Selenium WebDriver 是一个基于 Web 的自动化测试框架,可以测试在各种Web浏览器和各种操作系统上启动的网页。实际上,您还可以自由使用各种编程语言(例如Java、Perl、Python、Ruby、C#、PHP 和 JavaScript)编写测试脚本。请注意,Mozilla Firefox 是 Selenium WebDriver 的默认浏览器。元素是网页上存在的不同组件。文本框CTA 按钮图像超链接单选按钮 / 复选框文字区 / 错误信息。

1162

双模音频解码器设计:USB+蓝牙LDAC平衡输出方案

音频解码器是数字音频系统中实现数模转换的核心组件,其性能直接决定音质保真度与系统延迟。基于高集成SoC的解码方案通过统一时钟域与片内DSP处理,有效抑制Jitter并简化硬件拓扑;结合全平衡模拟输出架构,可显著提升共模抑制比(CMRR)与信噪比(SNR)。该技术路径广泛应用于便携式Hi-Res音频设备、USB-C小尾巴DAC及蓝牙高解析耳机放大器等场景。本文围绕ES9038Q2M双模SoC展开,详解其在LDAC协议支持、UAC2.0兼容性及平衡电流型DAC输出方面的工程实现,为高性能、可量产音频硬件开发提供

weixin_42613018的博客 390

轻量级替代方案:用AIFlowy + Ollama在本地快速搭建一个可用的AI智能体平台

本文介绍了如何使用AIFlowy和Ollama在本地快速搭建轻量级AI智能体平台,涵盖从环境准备到智能体集成的全流程。通过简化部署步骤和优化性能,15分钟内即可完成搭建,适用于原型验证和小团队协作,显著提升开发效率。

weixin_29207533的博客 221

python3 selenium 事件监听

python3 selenium 事件监听 做UI层自动化代码运行起来抛出的各种异常让人捉急,在排查问题过程中debug模式的调试加日志信息是常用的手段。介绍一种一种方法能监听WebDriver的事件,可以在WebDriver事件发生前后做一些事情,利用这个特性可以完成很多东西,比如报错自动截图等。 from selenium import webdriver from selenium.webdriver.support.events import EventFiringWebDriver, Abstra

花小田的魔法屋 3629

雷电模拟器+Python 3.11:手把手教你用Frida-dexdump给安卓APK脱壳(附GDA查壳)

本文详细介绍了如何使用雷电模拟器和Python 3.11配合Frida-dexdump工具进行安卓APK脱壳的全流程。从环境配置、工具安装到脱壳操作和问题排查,提供了包含30+关键截图的保姆级教程,适合零基础用户快速上手。重点讲解了Frida工具链的使用技巧和GDA查壳方法,帮助读者掌握移动应用安全分析的基础技能。

weixin_42568801的博客 329

Python Selenium Web自动化框架 官网学习笔记

+环境搭建 1,python3.6+pycharm 2,selenium(2.xx/3.xx版本) pip install selenium==2.48.0 pip list pip show selenium pip uninstall selenium 3,安装浏览器驱动(浏览器版本对应selenium版本) 1,Firefox...

一碗烈酒的博客 2183

基于STM32L4XX、HAL库的MCP4561数字电位器驱动程序设计

/ HAL库需要左移一位。* @param address: 设备地址(0x2C-0x2F)* @param hmcp: MCP4561句柄。* @param hmcp: MCP4561句柄。* @param hmcp: MCP4561句柄。* @param hmcp: MCP4561句柄。* @param hmcp: MCP4561句柄。* @param hmcp: MCP4561句柄。* @param hmcp: MCP4561句柄。* @param hi2c: I2C句柄。

zhusl6688的博客 341

「自然语言驱动生产力」23. 科研神器:DeepSeek+EndNote实现文献智能综述

摘要:传统文献综述面临周期长、漏检率高、数据整合繁琐等痛点,某985课题组数据显示,4人团队完成一篇综述平均需5个月,重要成果遗漏率达25%。本文提出基于DeepSeek+EndNote的智能综述方案,通过“自然语言解析→精准检索→智能筛选→自动生成”四步流程实现全自动化。核心技术包括检索式智能生成算法、文献优先级评分模型、可视化图表自动生成工具及结构化综述框架引擎。实际应用中,文献调研周期从3-6个月缩短至2周,重要成果遗漏率降至3%以下,图表制作时间完全解放。某课题组采用该方案后,1人3周完成的综述被A

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 1667

selenium学习(三)

该模块只包含一个类AbstractEventListener,主要用于事件侦听器,但是类中所有得方法均未实现,所以需要进行继承后挑选需要得部分进行实现""""""passpasspasspass。

wdnmdbga的博客 427

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

Selenium3 Python WebDriver API源码探析(20)WebDriver协议概述

WebDriver协议 早期Selenium和WebDriver是两个独立的项目,Selenium早期主要依靠将操作转换为JavaScript然后注入浏览器实现浏览器的自动化,WebDriver将浏览器原生API封装成一套更加面向对象的API,但是由于不同浏览器内核的差异,因此为了适配,必须对不同浏览器实现不同的API。在Selenium2之后两个项目合并,我们常说的Selenium其实主要指的就是WebDriver API。当前Selenium稳定版本的主版本为3,beta版本的Selenium4已经在路

mighty13的专栏 3万+

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Selenium3 Python WebDriver API源码探析(11)WebDriver Capabilities(驱动功能)概述,FirefoxOptions

Selenium通过WebDriver操控浏览器,WebDriver不单是远程控制接口,也是W3C的推荐标准详见https://www.w3.org/TR/webdriver/。 Capabilities(功能)是WebDriver支持的标准命令之外的扩展命令,用于控制端与浏览器端之间对一些特性进行通讯,控制端可以使用Capabilities定义浏览器端创建新会话时需要满足的一些特性。浏览器端也可以用Capabilities描述会话所支持的特性集。 WebDriver支持的Capabilities分为两类,

mighty13的专栏 3万+

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

Selenium3 Python WebDriver API源码探析(1):Selenium基本概念、环境部署

Selenium 简介 Selenium 是支持 Web 浏览器自动化的一系列工具和库的集合。Selenium 是开源项目。目前最新版本为Selenium 3。 Selenium 支持多平台,如:Linux、Windows和mac OS。 Selenium 支持多种编程语言,如:Java、Python、C#、Ruby、JavaScript、Kotlin Selenium 支持多种浏览器,如:IE、Firefox、Google Chrome、Edge、Safari、Opera等 Selenium项目主要包括以

mighty13的专栏 3万+

Selenium3 Python WebDriver API源码探析(4):Web元素的属性和方法

Selenium中网页中DOM元素的实现为selenium\webdriver\remote\webelement.py中的WebElement类。 WebDriver API中定位元素的方法在《Selenium3 Python WebDriver API源码探析(3):定位元素》已经简单介绍。本文主要介绍网页元素的属性和方法。 属性或特性 元素的标签名称 作用:获得当前元素的标签名称 签名:el.tag_name 返回值:字符串,例如'input' 元素的文本 作用:获得当前元素的文本内容 签名:el.t

mighty13的专栏 3万+

Selenium3 Python WebDriver API源码探析(12)FireFox自定义功能(FirefoxOptions)的实现:Options类

FireFox自定义功能的相关实现 根据《Selenium3 Python WebDriver API源码探析(11)WebDriver Capabilities(驱动功能)概述,FirefoxOptions》可知,WebDriver实现通过Capabilities定义新会话启动时的各种特性,也可以返回会话的特性集。Capabilities分为两类,一类是标准Capabilities,一类是各WebDriver实现的特定Capabilities。对于FireFox WebDriver 即geckodrive

mighty13的专栏 3万+

Selenium3 Python WebDriver API源码探析(19)加载FireFox用户配置文件

FireFox用户配置文件 Firefox 将用户个人信息(例如书签、密码、首选项、扩展、Cookie、证书等)保存在一系列文件中,它们被叫做用户配置文件,它们与 Firefox 的程序文件保存在不同位置。 因此,WebDriver如果能够加载已有的FireFox用户配置文件可带来很多便利! 查找用户配置文件 Firefox默认在本地路径C:\Users\<your Windows login username>\AppData\Roaming\Mozilla\Firefox\Profiles\

mighty13的专栏 3万+

Selenium3 Python WebDriver API源码探析(15)Cookie管理

Cookie是从网站发送并存储在计算机中的一小段数据。 Cookies主要用于识别用户并加载存储的信息。WebDriver API提供了一系列与Cookie进行交互的内置方法。selenium\webdriver\remote\webdriver.py中的WebDriver类实现了相关方法。 Cookie相关API 添加Cookie Selenium用于添加Cookie的方法为add_cookie(cookie_dict),cookie_dict参数的格式为一组已定义的可序列化JSON对象(字典),具体取值

mighty13的专栏 3万+

Selenium3 Python WebDriver API源码探析(13)FireFox设置代理

数据采集过程中经常需要用到代理,Selenium也支持代理功能,selenium\webdriver\common\proxy.py提供了代理数据结构的实现。Selenium实现代理的方法有很多种,不同WebDriver实现实现代理的方法也不尽相同。由于经常使用FireFox浏览器,因此,以geckodriver作为案例来演示代理功能。 官方文档推荐使用Capabilities 根据《Selenium3 Python WebDriver API源码探析(11)WebDriver Capabilities(驱

mighty13的专栏 3万+

Selenium3 Python WebDriver API源码探析(3):定位Web元素

定位元素是任何与Web进行交互操作的基础,JavaScript如是,对于Selenium亦如是。只有定位到了元素,才能对元素进行操作。 Selenium中的两个基础元素定位方法(find_element与 find_elements) 在Selenium中使用find_element与 find_elements方法即可完成元素的定位。 我们先简单对比下这两个方法,再讲相关的细节: find_element : 函数签名:def find_element(self, by=By.ID, value=No

mighty13的专栏 3万+

Selenium3 Python WebDriver API源码探析(6):窗口(标签)管理(切换、关闭)

WebDriver 不区分窗口和标签页。如果打开了一个新窗口(标签),可以使用窗口句柄(handle)来处理它。 每个窗口都有一个唯一的标识符,该标识符在单个会话中保持持久性。 获取当前窗口句柄 作用:获取当前窗口句柄 签名:driver.current_window_handle 调用对象:WebDriver实例 值类型:字符串 获取浏览器窗口句柄集合 作用:获取当前浏览器的窗口句柄集合 签名:driver.window_handles 调用对象:WebDriver实例 值类型:字符串列表 打开并切换新窗

mighty13的专栏 3万+

selenium源码阅读1:目录结构和异常模块

1、准备工作 安装python3 安装selenium3 2、python端selenium API源码结构 正在上传…重新上传取消 common:定义了通用的异常类 exceptions:定义了所有可能在webdriver代码中可能出现的异常 webdriver:核心实现 android:android浏览器支持 blackberry:blackberry平台支持 chrome:谷歌浏览器支持 edge:微软最新的edge浏览器支持,一般要windows.

九斤 307

Selenium3 Python WebDriver API源码探析(18)FireFox WebDriver实现,安装扩展

根据《Selenium3 Python WebDriver API源码探析(2):Selenium包目录结构、模块功能概述》可知,selenium\webdriver\remote\webdriver.py模块中的WebDriver类定义了通用WebDriver的基本特性,各种浏览器根据自身特性继承WebDriver类再做进一步实现。selenium\webdriver\firefox\webdriver.py模块中的WebDriver类实现了FireFox WebDriver,并通过selenium\we

mighty13的专栏 3万+

selenium 目录结构解释(想要学好selenium 要先看这篇)

common目录 定义了通用的异常类 webdriver目录 android、backberry、chrome、edge、firefox、ie、opera、phantomjs、safari、webkitgtk为不同模式的浏览器的支持 common为通用的一些定义 support为一些辅助支持功能 ...

weixin_30609331的博客 438
上一篇: Selenium3 Python WebDriver API源码探析(1):Selenium基本概念、环境部署
下一篇: Selenium3 Python WebDriver API源码探析(3):定位Web元素
mighty13
博客等级 码龄23年 728粉丝 438原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值