本文整理汇总了Python中selenium.webdriver.common.desired_capabilities.DesiredCapabilities.OPERA属性的典型用法代码示例。如果您正苦于以下问题:Python DesiredCapabilities.OPERA属性的具体用法?Python DesiredCapabilities.OPERA怎么用?Python DesiredCapabilities.OPERA使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类selenium.webdriver.common.desired_capabilities.DesiredCapabilities
的用法示例。
在下文中一共展示了DesiredCapabilities.OPERA属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_browserstack
# 需要导入模块: from selenium.webdriver.common.desired_capabilities import DesiredCapabilities [as 别名]
# 或者: from selenium.webdriver.common.desired_capabilities.DesiredCapabilities import OPERA [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 OPERA [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 OPERA [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 OPERA [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_opera
# 需要导入模块: from selenium.webdriver.common.desired_capabilities import DesiredCapabilities [as 别名]
# 或者: from selenium.webdriver.common.desired_capabilities.DesiredCapabilities import OPERA [as 别名]
def test_create_local_driver_opera(webdriver_mock, config):
config.set('Driver', 'type', 'opera')
config.set('Driver', 'opera_driver_path', '/tmp/driver')
config_driver = ConfigDriver(config)
config_driver._create_local_driver()
webdriver_mock.Opera.assert_called_once_with(desired_capabilities=DesiredCapabilities.OPERA,
executable_path='/tmp/driver')
示例6: test_create_remote_driver_opera
# 需要导入模块: from selenium.webdriver.common.desired_capabilities import DesiredCapabilities [as 别名]
# 或者: from selenium.webdriver.common.desired_capabilities.DesiredCapabilities import OPERA [as 别名]
def test_create_remote_driver_opera(webdriver_mock, config):
config.set('Driver', 'type', 'opera')
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.OPERA
capabilities['opera.autostart'] = True
capabilities['opera.arguments'] = '-fullscreen'
webdriver_mock.Remote.assert_called_once_with(command_executor='%s/wd/hub' % server_url,
desired_capabilities=capabilities)