• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python config_driver.ConfigDriver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中toolium.config_driver.ConfigDriver的典型用法代码示例。如果您正苦于以下问题:Python ConfigDriver类的具体用法?Python ConfigDriver怎么用?Python ConfigDriver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ConfigDriver类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_create_local_driver_edge

def test_create_local_driver_edge(webdriver_mock, config):
    config.set('Driver', 'type', 'edge')
    config.set('Driver', 'edge_driver_path', '/tmp/driver')
    config_driver = ConfigDriver(config)

    config_driver._create_local_driver()
    webdriver_mock.Edge.assert_called_once_with('/tmp/driver', capabilities=DesiredCapabilities.EDGE)
开发者ID:jframos,项目名称:toolium,代码行数:7,代码来源:test_config_driver.py


示例2: test_create_local_driver_iphone

def test_create_local_driver_iphone(config):
    config.set('Driver', 'type', 'iphone')
    config_driver = ConfigDriver(config)
    config_driver._create_remote_driver = lambda: 'remote driver mock'

    driver = config_driver._create_local_driver()
    assert driver == 'remote driver mock'
开发者ID:jframos,项目名称:toolium,代码行数:7,代码来源:test_config_driver.py


示例3: test_create_local_driver_unknown_driver

def test_create_local_driver_unknown_driver(config):
    config.set('Driver', 'type', 'unknown')
    config_driver = ConfigDriver(config)

    with pytest.raises(Exception) as excinfo:
        config_driver._create_local_driver()
    assert 'Unknown driver unknown' == str(excinfo.value)
开发者ID:jframos,项目名称:toolium,代码行数:7,代码来源:test_config_driver.py


示例4: test_create_local_driver_iexplore

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)
开发者ID:jframos,项目名称:toolium,代码行数:7,代码来源:test_config_driver.py


示例5: test_add_firefox_arguments

def test_add_firefox_arguments(config):
    config.add_section('FirefoxArguments')
    config.set('FirefoxArguments', '-private', '')
    config_driver = ConfigDriver(config)
    firefox_options = Options()

    config_driver._add_firefox_arguments(firefox_options)
    assert firefox_options.arguments == ['-private']
开发者ID:jframos,项目名称:toolium,代码行数:8,代码来源:test_config_driver.py


示例6: test_create_local_driver_phantomjs

def test_create_local_driver_phantomjs(webdriver_mock, config):
    config.set('Driver', 'type', 'phantomjs')
    config.set('Driver', 'phantomjs_driver_path', '/tmp/driver')
    config_driver = ConfigDriver(config)

    config_driver._create_local_driver()
    webdriver_mock.PhantomJS.assert_called_once_with(desired_capabilities=DesiredCapabilities.PHANTOMJS,
                                                     executable_path='/tmp/driver')
开发者ID:jframos,项目名称:toolium,代码行数:8,代码来源:test_config_driver.py


示例7: test_create_local_driver_opera

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:jframos,项目名称:toolium,代码行数:8,代码来源:test_config_driver.py


示例8: test_create_local_driver_chrome

def test_create_local_driver_chrome(webdriver_mock, config):
    config.set('Driver', 'type', 'chrome')
    config.set('Driver', 'chrome_driver_path', '/tmp/driver')
    config_driver = ConfigDriver(config)
    config_driver._create_chrome_options = lambda: 'chrome options'

    config_driver._create_local_driver()
    webdriver_mock.Chrome.assert_called_once_with('/tmp/driver', desired_capabilities=DesiredCapabilities.CHROME,
                                                  chrome_options='chrome options')
开发者ID:jframos,项目名称:toolium,代码行数:9,代码来源:test_config_driver.py


示例9: test_create_local_driver_firefox

def test_create_local_driver_firefox(webdriver_mock, config):
    config.set('Driver', 'type', 'firefox')
    config_driver = ConfigDriver(config)
    config_driver._create_firefox_profile = lambda: 'firefox profile'

    config_driver._create_local_driver()
    webdriver_mock.Firefox.assert_called_once_with(capabilities=DesiredCapabilities.FIREFOX,
                                                   firefox_profile='firefox profile', executable_path=None,
                                                   firefox_options=None)
开发者ID:Telefonica,项目名称:toolium,代码行数:9,代码来源:test_config_driver.py


示例10: test_create_driver_local_not_configured

def test_create_driver_local_not_configured(config):
    config.set('Driver', 'type', 'firefox')
    config_driver = ConfigDriver(config)
    config_driver._create_local_driver = lambda: 'local driver mock'
    config_driver._create_remote_driver = lambda: 'remote driver mock'

    driver = config_driver.create_driver()

    assert driver == 'local driver mock'
开发者ID:jframos,项目名称:toolium,代码行数:9,代码来源:test_config_driver.py


示例11: test_create_remote_driver_phantomjs

def test_create_remote_driver_phantomjs(webdriver_mock, config):
    config.set('Server', 'host', '10.20.30.40')
    config.set('Server', 'port', '5555')
    config.set('Driver', 'type', 'phantomjs')
    config_driver = ConfigDriver(config)

    config_driver._create_remote_driver()
    webdriver_mock.Remote.assert_called_once_with(command_executor='http://10.20.30.40:5555/wd/hub',
                                                  desired_capabilities=DesiredCapabilities.PHANTOMJS)
开发者ID:jframos,项目名称:toolium,代码行数:9,代码来源:test_config_driver.py


示例12: test_create_remote_driver_iexplore

def test_create_remote_driver_iexplore(webdriver_mock, config):
    config.set('Server', 'host', '10.20.30.40')
    config.set('Server', 'port', '5555')
    config.set('Driver', 'type', 'iexplore')
    config_driver = ConfigDriver(config)

    config_driver._create_remote_driver()
    webdriver_mock.Remote.assert_called_once_with(command_executor='http://10.20.30.40:5555/wd/hub',
                                                  desired_capabilities=DesiredCapabilities.INTERNETEXPLORER)
开发者ID:jframos,项目名称:toolium,代码行数:9,代码来源:test_config_driver.py


示例13: test_create_driver_remote

def test_create_driver_remote(config):
    config.set('Server', 'enabled', 'true')
    config.set('Driver', 'type', 'firefox')
    config_driver = ConfigDriver(config)
    config_driver._create_local_driver = lambda: 'local driver mock'
    config_driver._create_remote_driver = lambda: 'remote driver mock'

    driver = config_driver.create_driver()

    assert driver == 'remote driver mock'
开发者ID:jframos,项目名称:toolium,代码行数:10,代码来源:test_config_driver.py


示例14: test_create_chrome_options_headless

def test_create_chrome_options_headless(webdriver_mock, config):
    config.set('Driver', 'headless', 'true')
    config_driver = ConfigDriver(config)

    config_driver._create_chrome_options()
    webdriver_mock.ChromeOptions.assert_called_once_with()
    if os.name == 'nt':
        webdriver_mock.ChromeOptions().add_argument.assert_has_calls([mock.call('--headless'),
                                                                      mock.call('--disable-gpu')])
    else:
        webdriver_mock.ChromeOptions().add_argument.assert_called_once_with('--headless')
开发者ID:jframos,项目名称:toolium,代码行数:11,代码来源:test_config_driver.py


示例15: test_create_remote_driver_opera

def test_create_remote_driver_opera(webdriver_mock, config):
    config.set('Server', 'host', '10.20.30.40')
    config.set('Server', 'port', '5555')
    config.set('Driver', 'type', 'opera')
    config_driver = ConfigDriver(config)

    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='http://10.20.30.40:5555/wd/hub',
                                                  desired_capabilities=capabilities)
开发者ID:jframos,项目名称:toolium,代码行数:12,代码来源:test_config_driver.py


示例16: test_create_remote_driver_version_platform

def test_create_remote_driver_version_platform(webdriver_mock, config):
    config.set('Server', 'host', '10.20.30.40')
    config.set('Server', 'port', '5555')
    config.set('Driver', 'type', 'iexplore-11-on-WIN10')
    config_driver = ConfigDriver(config)

    config_driver._create_remote_driver()
    capabilities = DesiredCapabilities.INTERNETEXPLORER
    capabilities['version'] = '11'
    capabilities['platform'] = 'WIN10'
    webdriver_mock.Remote.assert_called_once_with(command_executor='http://10.20.30.40:5555/wd/hub',
                                                  desired_capabilities=capabilities)
开发者ID:jframos,项目名称:toolium,代码行数:12,代码来源:test_config_driver.py


示例17: test_create_local_driver_capabilities

def test_create_local_driver_capabilities(webdriver_mock, config):
    config.set('Driver', 'type', 'firefox')
    config.add_section('Capabilities')
    config.set('Capabilities', 'version', '45')
    config_driver = ConfigDriver(config)
    config_driver._create_firefox_profile = lambda: 'firefox profile'

    config_driver._create_local_driver()
    capabilities = DesiredCapabilities.FIREFOX.copy()
    capabilities['version'] = '45'
    webdriver_mock.Firefox.assert_called_once_with(capabilities=capabilities,
                                                   firefox_profile='firefox profile', executable_path=None,
                                                   firefox_options=None)
开发者ID:Telefonica,项目名称:toolium,代码行数:13,代码来源:test_config_driver.py


示例18: test_create_remote_driver_capabilities

def test_create_remote_driver_capabilities(webdriver_mock, config):
    config.set('Server', 'host', '10.20.30.40')
    config.set('Server', 'port', '5555')
    config.set('Driver', 'type', 'iexplore-11')
    config.add_section('Capabilities')
    config.set('Capabilities', 'version', '11')
    config_driver = ConfigDriver(config)

    config_driver._create_remote_driver()
    capabilities = DesiredCapabilities.INTERNETEXPLORER.copy()
    capabilities['version'] = '11'
    webdriver_mock.Remote.assert_called_once_with(command_executor='http://10.20.30.40:5555/wd/hub',
                                                  desired_capabilities=capabilities)
开发者ID:jframos,项目名称:toolium,代码行数:13,代码来源:test_config_driver.py


示例19: test_create_remote_driver_iphone

def test_create_remote_driver_iphone(appiumdriver_mock, config):
    config.set('Server', 'host', '10.20.30.40')
    config.set('Server', 'port', '5555')
    config.set('Driver', 'type', 'iphone')
    config.add_section('AppiumCapabilities')
    config.set('AppiumCapabilities', 'automationName', 'Appium')
    config.set('AppiumCapabilities', 'platformName', 'iOS')
    config_driver = ConfigDriver(config)

    config_driver._create_remote_driver()
    capabilities = {'automationName': 'Appium', 'platformName': 'iOS'}
    appiumdriver_mock.Remote.assert_called_once_with(command_executor='http://10.20.30.40:5555/wd/hub',
                                                     desired_capabilities=capabilities)
开发者ID:jframos,项目名称:toolium,代码行数:13,代码来源:test_config_driver.py


示例20: test_create_local_driver_firefox

def test_create_local_driver_firefox(webdriver_mock, options, config):
    config.set('Driver', 'type', 'firefox')
    config.add_section('Capabilities')
    config.set('Capabilities', 'marionette', 'false')
    config_driver = ConfigDriver(config)
    config_driver._create_firefox_profile = lambda: 'firefox profile'
    DriverWrappersPool.output_directory = ''

    config_driver._create_local_driver()
    expected_capabilities = DesiredCapabilities.FIREFOX.copy()
    expected_capabilities['marionette'] = False
    webdriver_mock.Firefox.assert_called_once_with(capabilities=expected_capabilities,
                                                   firefox_profile='firefox profile', executable_path=None,
                                                   firefox_options=options(), log_path='geckodriver.log')
开发者ID:jframos,项目名称:toolium,代码行数:14,代码来源:test_config_driver.py



注:本文中的toolium.config_driver.ConfigDriver类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python driver_wrappers_pool.DriverWrappersPool类代码示例发布时间:2022-05-27
下一篇:
Python toolchain.shprint函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap