本文整理汇总了Python中selenium.webdriver.common.desired_capabilities.DesiredCapabilities.INTERNETEXPLORER属性的典型用法代码示例。如果您正苦于以下问题:Python DesiredCapabilities.INTERNETEXPLORER属性的具体用法?Python DesiredCapabilities.INTERNETEXPLORER怎么用?Python DesiredCapabilities.INTERNETEXPLORER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类selenium.webdriver.common.desired_capabilities.DesiredCapabilities
的用法示例。
在下文中一共展示了DesiredCapabilities.INTERNETEXPLORER属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_browserstack
# 需要导入模块: from selenium.webdriver.common.desired_capabilities import DesiredCapabilities [as 别名]
# 或者: from selenium.webdriver.common.desired_capabilities.DesiredCapabilities import INTERNETEXPLORER [as 别名]
def run_browserstack(self,os_name,os_version,browser,browser_version,remote_project_name,remote_build_name):
"Run the test in browser stack when remote flag is 'Y'"
#Get the browser stack credentials from browser stack credentials file
USERNAME = remote_credentials.USERNAME
PASSWORD = remote_credentials.ACCESS_KEY
if browser.lower() == 'ff' or browser.lower() == 'firefox':
desired_capabilities = DesiredCapabilities.FIREFOX
elif browser.lower() == 'ie':
desired_capabilities = DesiredCapabilities.INTERNETEXPLORER
elif browser.lower() == 'chrome':
desired_capabilities = DesiredCapabilities.CHROME
elif browser.lower() == 'opera':
desired_capabilities = DesiredCapabilities.OPERA
elif browser.lower() == 'safari':
desired_capabilities = DesiredCapabilities.SAFARI
desired_capabilities['os'] = os_name
desired_capabilities['os_version'] = os_version
desired_capabilities['browser_version'] = browser_version
if remote_project_name is not None:
desired_capabilities['project'] = remote_project_name
if remote_build_name is not None:
desired_capabilities['build'] = remote_build_name+"_"+str(datetime.now().strftime("%c"))
return webdriver.Remote(RemoteConnection("http://%s:%s@hub-cloud.browserstack.com/wd/hub"%(USERNAME,PASSWORD),resolve_ip= False),
desired_capabilities=desired_capabilities)
示例2: run_sauce_lab
# 需要导入模块: from selenium.webdriver.common.desired_capabilities import DesiredCapabilities [as 别名]
# 或者: from selenium.webdriver.common.desired_capabilities.DesiredCapabilities import INTERNETEXPLORER [as 别名]
def run_sauce_lab(self,os_name,os_version,browser,browser_version):
"Run the test in sauce labs when remote flag is 'Y'"
#Get the sauce labs credentials from sauce.credentials file
USERNAME = remote_credentials.USERNAME
PASSWORD = remote_credentials.ACCESS_KEY
if browser.lower() == 'ff' or browser.lower() == 'firefox':
desired_capabilities = DesiredCapabilities.FIREFOX
elif browser.lower() == 'ie':
desired_capabilities = DesiredCapabilities.INTERNETEXPLORER
elif browser.lower() == 'chrome':
desired_capabilities = DesiredCapabilities.CHROME
elif browser.lower() == 'opera':
desired_capabilities = DesiredCapabilities.OPERA
elif browser.lower() == 'safari':
desired_capabilities = DesiredCapabilities.SAFARI
desired_capabilities['version'] = browser_version
desired_capabilities['platform'] = os_name + ' '+os_version
return webdriver.Remote(command_executor="http://%s:%s@ondemand.saucelabs.com:80/wd/hub"%(USERNAME,PASSWORD),
desired_capabilities= desired_capabilities)
示例3: run_browserstack
# 需要导入模块: from selenium.webdriver.common.desired_capabilities import DesiredCapabilities [as 别名]
# 或者: from selenium.webdriver.common.desired_capabilities.DesiredCapabilities import INTERNETEXPLORER [as 别名]
def run_browserstack(self,os_name,os_version,browser,browser_version,remote_project_name,remote_build_name):
"Run the test in browser stack when remote flag is 'Y'"
#Get the browser stack credentials from browser stack credentials file
USERNAME = remote_credentials.USERNAME
PASSWORD = remote_credentials.ACCESS_KEY
if browser.lower() == 'ff' or browser.lower() == 'firefox':
desired_capabilities = DesiredCapabilities.FIREFOX
elif browser.lower() == 'ie':
desired_capabilities = DesiredCapabilities.INTERNETEXPLORER
elif browser.lower() == 'chrome':
desired_capabilities = DesiredCapabilities.CHROME
elif browser.lower() == 'opera':
desired_capabilities = DesiredCapabilities.OPERA
elif browser.lower() == 'safari':
desired_capabilities = DesiredCapabilities.SAFARI
desired_capabilities['os'] = os_name
desired_capabilities['os_version'] = os_version
desired_capabilities['browser_version'] = browser_version
if remote_project_name is not None:
desired_capabilities['project'] = remote_project_name
if remote_build_name is not None:
desired_capabilities['build'] = remote_build_name+"_"+str(datetime.now().strftime("%c"))
return webdriver.Remote(RemoteConnection("http://%s:%s@hub-cloud.browserstack.com/wd/hub"%(USERNAME,PASSWORD),resolve_ip= False),
desired_capabilities=desired_capabilities)
示例4: run_sauce_lab
# 需要导入模块: from selenium.webdriver.common.desired_capabilities import DesiredCapabilities [as 别名]
# 或者: from selenium.webdriver.common.desired_capabilities.DesiredCapabilities import INTERNETEXPLORER [as 别名]
def run_sauce_lab(self,os_name,os_version,browser,browser_version):
"Run the test in sauce labs when remote flag is 'Y'"
#Get the sauce labs credentials from sauce.credentials file
USERNAME = remote_credentials.USERNAME
PASSWORD = remote_credentials.ACCESS_KEY
if browser.lower() == 'ff' or browser.lower() == 'firefox':
desired_capabilities = DesiredCapabilities.FIREFOX
elif browser.lower() == 'ie':
desired_capabilities = DesiredCapabilities.INTERNETEXPLORER
elif browser.lower() == 'chrome':
desired_capabilities = DesiredCapabilities.CHROME
elif browser.lower() == 'opera':
desired_capabilities = DesiredCapabilities.OPERA
elif browser.lower() == 'safari':
desired_capabilities = DesiredCapabilities.SAFARI
desired_capabilities['version'] = browser_version
desired_capabilities['platform'] = os_name + ' '+os_version
return webdriver.Remote(command_executor="http://%s:%s@ondemand.saucelabs.com:80/wd/hub"%(USERNAME,PASSWORD),
desired_capabilities= desired_capabilities)
示例5: test_create_local_driver_iexplore
# 需要导入模块: from selenium.webdriver.common.desired_capabilities import DesiredCapabilities [as 别名]
# 或者: from selenium.webdriver.common.desired_capabilities.DesiredCapabilities import INTERNETEXPLORER [as 别名]
def test_create_local_driver_iexplore(webdriver_mock, config):
config.set('Driver', 'type', 'iexplore')
config.set('Driver', 'explorer_driver_path', '/tmp/driver')
config_driver = ConfigDriver(config)
config_driver._create_local_driver()
webdriver_mock.Ie.assert_called_once_with('/tmp/driver', capabilities=DesiredCapabilities.INTERNETEXPLORER)
示例6: test_create_remote_driver_iexplore
# 需要导入模块: from selenium.webdriver.common.desired_capabilities import DesiredCapabilities [as 别名]
# 或者: from selenium.webdriver.common.desired_capabilities.DesiredCapabilities import INTERNETEXPLORER [as 别名]
def test_create_remote_driver_iexplore(webdriver_mock, config):
config.set('Driver', 'type', 'iexplore')
server_url = 'http://10.20.30.40:5555'
utils = mock.MagicMock()
utils.get_server_url.return_value = server_url
config_driver = ConfigDriver(config, utils)
config_driver._create_remote_driver()
webdriver_mock.Remote.assert_called_once_with(command_executor='%s/wd/hub' % server_url,
desired_capabilities=DesiredCapabilities.INTERNETEXPLORER)
示例7: test_create_remote_driver_version_platform
# 需要导入模块: from selenium.webdriver.common.desired_capabilities import DesiredCapabilities [as 别名]
# 或者: from selenium.webdriver.common.desired_capabilities.DesiredCapabilities import INTERNETEXPLORER [as 别名]
def test_create_remote_driver_version_platform(webdriver_mock, config):
config.set('Driver', 'type', 'iexplore-11-on-WIN10')
server_url = 'http://10.20.30.40:5555'
utils = mock.MagicMock()
utils.get_server_url.return_value = server_url
config_driver = ConfigDriver(config, utils)
config_driver._create_remote_driver()
capabilities = DesiredCapabilities.INTERNETEXPLORER
capabilities['version'] = '11'
capabilities['platform'] = 'WIN10'
webdriver_mock.Remote.assert_called_once_with(command_executor='%s/wd/hub' % server_url,
desired_capabilities=capabilities)
示例8: test_create_remote_driver_version
# 需要导入模块: from selenium.webdriver.common.desired_capabilities import DesiredCapabilities [as 别名]
# 或者: from selenium.webdriver.common.desired_capabilities.DesiredCapabilities import INTERNETEXPLORER [as 别名]
def test_create_remote_driver_version(webdriver_mock, config):
config.set('Driver', 'type', 'iexplore-11')
server_url = 'http://10.20.30.40:5555'
utils = mock.MagicMock()
utils.get_server_url.return_value = server_url
config_driver = ConfigDriver(config, utils)
config_driver._create_remote_driver()
capabilities = DesiredCapabilities.INTERNETEXPLORER.copy()
capabilities['version'] = '11'
webdriver_mock.Remote.assert_called_once_with(command_executor='%s/wd/hub' % server_url,
desired_capabilities=capabilities)
示例9: test_create_remote_driver_capabilities
# 需要导入模块: from selenium.webdriver.common.desired_capabilities import DesiredCapabilities [as 别名]
# 或者: from selenium.webdriver.common.desired_capabilities.DesiredCapabilities import INTERNETEXPLORER [as 别名]
def test_create_remote_driver_capabilities(webdriver_mock, config):
config.set('Driver', 'type', 'iexplore-11')
config.add_section('Capabilities')
config.set('Capabilities', 'version', '11')
server_url = 'http://10.20.30.40:5555'
utils = mock.MagicMock()
utils.get_server_url.return_value = server_url
config_driver = ConfigDriver(config, utils)
config_driver._create_remote_driver()
capabilities = DesiredCapabilities.INTERNETEXPLORER.copy()
capabilities['version'] = '11'
webdriver_mock.Remote.assert_called_once_with(command_executor='%s/wd/hub' % server_url,
desired_capabilities=capabilities)
示例10: start
# 需要导入模块: from selenium.webdriver.common.desired_capabilities import DesiredCapabilities [as 别名]
# 或者: from selenium.webdriver.common.desired_capabilities.DesiredCapabilities import INTERNETEXPLORER [as 别名]
def start(self, **kwargs):
'''
get root ready
like get root element in windows UIA, get browser to target website
must have a "browser_name" argument in kwargs to indicate which browser to use
other kwargs are same as normal selenium webdrivers
'''
if not "browser_name" in kwargs:
LOGGER.error("Browser name not specified")
raise DriverException("Browser name not specified")
browser_name = kwargs["browser_name"]
if not browser_name.upper() in self.support_browsers:
LOGGER.error("Unsupported browser name: %s" , browser_name)
raise DriverException("Unsupported browser name: %s" % browser_name)
#remove browser_name key from kwargs
del kwargs["browser_name"]
#for ie browser, need to ignore zoom settings
if browser_name.upper() == "IE":
if "capabilities" in kwargs:
#insert "ignoreZoomSetting" in driver capabilities
caps = kwargs["capabilities"]
caps["ignoreZoomSetting"] = True
else:
#add default capabilities
caps = DesiredCapabilities.INTERNETEXPLORER
caps["ignoreZoomSetting"] = True
kwargs["capabilities"] = caps
self.webdriver = self.support_browsers[browser_name.upper()](**kwargs)