本文整理匯總了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)