Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/py/selenium/webdriver/common/desired_capabilities.py
4025 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
from selenium.webdriver.firefox.options import Options
30
31
selenium_grid_url = "http://198.0.0.1:4444/wd/hub"
32
33
# Create a new Options object for the desired browser.
34
options = Options()
35
options.set_capability("platformName", "windows")
36
options.browser_version = "142"
37
38
# Instantiate an instance of Remote WebDriver with the new options.
39
driver = webdriver.Remote(command_executor=selenium_grid_url, options=options)
40
"""
41
42
FIREFOX = {
43
"browserName": "firefox",
44
"acceptInsecureCerts": True,
45
"moz:debuggerAddress": True,
46
}
47
48
INTERNETEXPLORER = {
49
"browserName": "internet explorer",
50
"platformName": "windows",
51
}
52
53
EDGE = {
54
"browserName": "MicrosoftEdge",
55
}
56
57
CHROME = {
58
"browserName": "chrome",
59
}
60
61
SAFARI = {
62
"browserName": "safari",
63
"platformName": "mac",
64
}
65
66
HTMLUNIT = {
67
"browserName": "htmlunit",
68
"version": "",
69
"platform": "ANY",
70
}
71
72
HTMLUNITWITHJS = {
73
"browserName": "htmlunit",
74
"version": "firefox",
75
"platform": "ANY",
76
"javascriptEnabled": True,
77
}
78
79
IPHONE = {
80
"browserName": "iPhone",
81
"version": "",
82
"platform": "mac",
83
}
84
85
IPAD = {
86
"browserName": "iPad",
87
"version": "",
88
"platform": "mac",
89
}
90
91
WEBKITGTK = {
92
"browserName": "MiniBrowser",
93
}
94
95
WPEWEBKIT = {
96
"browserName": "MiniBrowser",
97
}
98
99