Path: blob/trunk/py/selenium/webdriver/common/desired_capabilities.py
1864 views
# Licensed to the Software Freedom Conservancy (SFC) under one1# or more contributor license agreements. See the NOTICE file2# distributed with this work for additional information3# regarding copyright ownership. The SFC licenses this file4# to you under the Apache License, Version 2.0 (the5# "License"); you may not use this file except in compliance6# with the License. You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing,11# software distributed under the License is distributed on an12# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY13# KIND, either express or implied. See the License for the14# specific language governing permissions and limitations15# under the License.16"""The Desired Capabilities implementation."""171819class DesiredCapabilities:20"""Set of default supported desired capabilities.2122Use this as a starting point for creating a desired capabilities object for23requesting remote webdrivers for connecting to selenium server or selenium grid.2425Usage Example::2627from selenium import webdriver2829selenium_grid_url = "http://198.0.0.1:4444/wd/hub"3031# Create a desired capabilities object as a starting point.32capabilities = DesiredCapabilities.FIREFOX.copy()33capabilities["platform"] = "WINDOWS"34capabilities["version"] = "10"3536# Instantiate an instance of Remote WebDriver with the desired capabilities.37driver = webdriver.Remote(desired_capabilities=capabilities, command_executor=selenium_grid_url)3839Note: Always use '.copy()' on the DesiredCapabilities object to avoid the side40effects of altering the Global class instance.41"""4243FIREFOX = {44"browserName": "firefox",45"acceptInsecureCerts": True,46"moz:debuggerAddress": True,47}4849INTERNETEXPLORER = {50"browserName": "internet explorer",51"platformName": "windows",52}5354EDGE = {55"browserName": "MicrosoftEdge",56}5758CHROME = {59"browserName": "chrome",60}6162SAFARI = {63"browserName": "safari",64"platformName": "mac",65}6667HTMLUNIT = {68"browserName": "htmlunit",69"version": "",70"platform": "ANY",71}7273HTMLUNITWITHJS = {74"browserName": "htmlunit",75"version": "firefox",76"platform": "ANY",77"javascriptEnabled": True,78}7980IPHONE = {81"browserName": "iPhone",82"version": "",83"platform": "mac",84}8586IPAD = {87"browserName": "iPad",88"version": "",89"platform": "mac",90}9192WEBKITGTK = {93"browserName": "MiniBrowser",94}9596WPEWEBKIT = {97"browserName": "MiniBrowser",98}99100101