當前位置: 首頁>>代碼示例>>Python>>正文


Python DesiredCapabilities.OPERA屬性代碼示例

本文整理匯總了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) 
開發者ID:qxf2,項目名稱:makemework,代碼行數:27,代碼來源:DriverFactory.py

示例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) 
開發者ID:qxf2,項目名稱:makemework,代碼行數:23,代碼來源:DriverFactory.py

示例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) 
開發者ID:qxf2,項目名稱:qxf2-page-object-model,代碼行數:27,代碼來源:DriverFactory.py

示例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) 
開發者ID:qxf2,項目名稱:qxf2-page-object-model,代碼行數:23,代碼來源:DriverFactory.py

示例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') 
開發者ID:Telefonica,項目名稱:toolium,代碼行數:10,代碼來源:test_config_driver.py

示例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) 
開發者ID:Telefonica,項目名稱:toolium,代碼行數:15,代碼來源:test_config_driver.py


注:本文中的selenium.webdriver.common.desired_capabilities.DesiredCapabilities.OPERA屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。