Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/py/selenium/webdriver/common/desired_capabilities.py
1864 views
1
# Licensed to the Software Freedom Conservancy (SFC) under one
2
# or more contributor license agreements. See the NOTICE file
3
# distributed with this work for additional information
4
# regarding copyright ownership. The SFC licenses this file
5
# to you under the Apache License, Version 2.0 (the
6
# "License"); you may not use this file except in compliance
7
# with the License. You may obtain a copy of the License at
8
#
9
# http://www.apache.org/licenses/LICENSE-2.0
10
#
11
# Unless required by applicable law or agreed to in writing,
12
# software distributed under the License is distributed on an
13
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
# KIND, either express or implied. See the License for the
15
# specific language governing permissions and limitations
16
# under the License.
17
"""The Desired Capabilities implementation."""
18
19
20
class DesiredCapabilities:
21
"""Set of default supported desired capabilities.
22
23
Use this as a starting point for creating a desired capabilities object for
24
requesting remote webdrivers for connecting to selenium server or selenium grid.
25
26
Usage Example::
27
28
from selenium import webdriver
29
30
selenium_grid_url = "http://198.0.0.1:4444/wd/hub"
31
32
# Create a desired capabilities object as a starting point.
33
capabilities = DesiredCapabilities.FIREFOX.copy()
34
capabilities["platform"] = "WINDOWS"
35
capabilities["version"] = "10"
36
37
# Instantiate an instance of Remote WebDriver with the desired capabilities.
38
driver = webdriver.Remote(desired_capabilities=capabilities, command_executor=selenium_grid_url)
39
40
Note: Always use '.copy()' on the DesiredCapabilities object to avoid the side
41
effects of altering the Global class instance.
42
"""
43
44
FIREFOX = {
45
"browserName": "firefox",
46
"acceptInsecureCerts": True,
47
"moz:debuggerAddress": True,
48
}
49
50
INTERNETEXPLORER = {
51
"browserName": "internet explorer",
52
"platformName": "windows",
53
}
54
55
EDGE = {
56
"browserName": "MicrosoftEdge",
57
}
58
59
CHROME = {
60
"browserName": "chrome",
61
}
62
63
SAFARI = {
64
"browserName": "safari",
65
"platformName": "mac",
66
}
67
68
HTMLUNIT = {
69
"browserName": "htmlunit",
70
"version": "",
71
"platform": "ANY",
72
}
73
74
HTMLUNITWITHJS = {
75
"browserName": "htmlunit",
76
"version": "firefox",
77
"platform": "ANY",
78
"javascriptEnabled": True,
79
}
80
81
IPHONE = {
82
"browserName": "iPhone",
83
"version": "",
84
"platform": "mac",
85
}
86
87
IPAD = {
88
"browserName": "iPad",
89
"version": "",
90
"platform": "mac",
91
}
92
93
WEBKITGTK = {
94
"browserName": "MiniBrowser",
95
}
96
97
WPEWEBKIT = {
98
"browserName": "MiniBrowser",
99
}
100
101