The Desired Capabilities implementation.

class selenium.webdriver.common.desired_capabilities.DesiredCapabilities

Bases: object

Set of default supported desired capabilities.

Use this as a starting point for creating a desired capabilities object for requesting remote webdrivers for connecting to selenium server or selenium grid.

Usage Example:

from selenium import webdriver

selenium_grid_url = “http://198.0.0.1:4444/wd/hub

# Create a desired capabilities object as a starting point. capabilities = DesiredCapabilities.FIREFOX.copy() capabilities[‘platform’] = “WINDOWS” capabilities[‘version’] = “10”

# Instantiate an instance of Remote WebDriver with the desired capabilities. driver = webdriver.Remote(desired_capabilities=capabilities,

command_executor=selenium_grid_url)

Note: Always use ‘.copy()’ on the DesiredCapabilities object to avoid the side effects of altering the Global class instance.

ANDROID= {'platform': 'ANDROID', 'browserName': 'android', 'version': '', 'javascriptEnabled': True}
CHROME= {'platform': 'ANY', 'browserName': 'chrome', 'version': '', 'javascriptEnabled': True}
FIREFOX= {'platform': 'ANY', 'browserName': 'firefox', 'version': '', 'javascriptEnabled': True}
HTMLUNIT= {'platform': 'ANY', 'browserName': 'htmlunit', 'version': ''}
HTMLUNITWITHJS= {'platform': 'ANY', 'browserName': 'htmlunit', 'version': 'firefox', 'javascriptEnabled': True}
INTERNETEXPLORER= {'platform': 'WINDOWS', 'browserName': 'internet explorer', 'version': '', 'javascriptEnabled': True}
IPAD= {'platform': 'MAC', 'browserName': 'iPad', 'version': '', 'javascriptEnabled': True}
IPHONE= {'platform': 'MAC', 'browserName': 'iPhone', 'version': '', 'javascriptEnabled': True}
OPERA= {'platform': 'ANY', 'browserName': 'opera', 'version': '', 'javascriptEnabled': True}
PHANTOMJS= {'platform': 'ANY', 'browserName': 'phantomjs', 'version': '', 'javascriptEnabled': True}
SAFARI= {'platform': 'ANY', 'browserName': 'safari', 'version': '', 'javascriptEnabled': True}

webDriver API——第7部分Desired Capabilities的更多相关文章

  1. python2.7运行selenium webdriver api报错Unable to find a matching set of capabilities

    在火狐浏览器33版本,python2.7运行selenium webdriver api报错:SessionNotCreatedException: Message: Unable to find a ...

  2. <译>Selenium Python Bindings 6 - WebDriver API

    本章涉及Selenium WebDriver的所有接口. Recommended Import Style 推荐的导入风格如下: from selenium import webdriver 然后,你 ...

  3. python+selenium自动化软件测试(第2章):WebDriver API

    2.1 操作元素基本方法 前言前面已经把环境搭建好了,从这篇开始,正式学习selenium的webdriver框架.我们平常说的 selenium自动化,其实它并不是类似于QTP之类的有GUI界面的可 ...

  4. 2.28 查看webdriver API

    2.28 查看webdriver API(带翻译) 前言    前面都是点点滴滴的介绍selenium的一些api使用方法,那么selenium的api到底有多少呢?本篇就教大家如何去查看seleni ...

  5. webdriver API study

    This chapter cover all the interfaces of Selenium WebDriver. Recommended Import Style The API defini ...

  6. Selenium with Python 009 - WebDriver API

    官方API文档:https://seleniumhq.github.io/selenium/docs/api/py/api.html 更多详情,最好的学习方式可以查阅官方API文档或直接阅读源码,本文 ...

  7. Appium 工作原理及 Desired Capabilities

    一.Appium工作原理 脚本请求 --> 4723端口appium server --> 解析参数给PC端4724端口 --> 发送给设备4724端口 --> 通过设备472 ...

  8. Webdriver API (二)

    (转载) 1.3 打开测试页面 对页面对测试,首先要打开被测试页面的地址(如:http://www.google.com),web driver 提供的get方法可以打开一个页面: // And no ...

  9. Selenium2+Python:Webdriver API速记手册

    由于web自动化常常需要控制浏览器行为和操作页面元素,相关函数又比较多,于是再此记下一份Webdriver API查阅文档以备不时之需. 参考:虫师<Selenium2自动化测试实战>,和 ...

随机推荐

  1. Java数组(int为例)

    Java数组(int为例) 定义:相同数据类型的数据的组合,是一种引用类型,是一个对象,存在堆里. 数组初始化:int[] scores1 = new int[]{72,90,59};//静态初始化: ...

  2. cookies和session区别

    session原理:1.session是保存在服务器端,理论上是没有是没有限制,只要你的内存够大   2.浏览器第一次访问服务器时会创建一个session对象并返回一个JSESSIONID=ID的值, ...

  3. 如何去除windows下文本的^M

    使用vi编辑,输入命令: :%s/^M/\r/g 用来把^M换成回车 注意的是^M要使用CTRL-V CTRL-M生成,而不是直接键入^M

  4. 【51Nod 1239】欧拉函数之和

    http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1239 还是模板题. 杜教筛:\[S(n)=\frac{n(n+1)}{2 ...

  5. bzoj 2038 小Z的袜子(hose)(莫队算法)

    2038: [2009国家集训队]小Z的袜子(hose) Time Limit: 20 Sec  Memory Limit: 259 MBSubmit: 11542  Solved: 5166[Sub ...

  6. CodeForces - 995B Suit and Tie

    题面在这里! 明明可以出成n<=1e5但是因为拒绝写数据结构而只出到n<=100,,,出题人真的很棒棒.. 一个显然的贪心就是,把和当前序列最左端的数匹配的数移到它的右边,这样迭代下去总是 ...

  7. BZOJ 1827 [Usaco2010 Mar]gather 奶牛大集会(树形DP)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=1827 [题目大意] 给出一棵有点权和边权的树, 请确定一个点,使得每个点到这个点的距离 ...

  8. Java中的文件操作(一)RandomAccessFile

    今天,学到的是java中的文件操作. Java.IO.File Java中操作文件用到RandomAccessFile类,既可以读取文件内容,也可以向文件输出数据,但不同与普通输入/输出流的是Rand ...

  9. Educational Codeforces Round 7 F. The Sum of the k-th Powers 拉格朗日插值法

    F. The Sum of the k-th Powers 题目连接: http://www.codeforces.com/contest/622/problem/F Description Ther ...

  10. countdownlatch用法

    public void await() throws InterruptedException { };   //调用await()方法的线程会被挂起,它会等待直到count值为0才继续执行 publ ...