本文整理汇总了Python中pyccuracy.drivers.core.selenium_driver.SeleniumDriver类的典型用法代码示例。如果您正苦于以下问题:Python SeleniumDriver类的具体用法?Python SeleniumDriver怎么用?Python SeleniumDriver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SeleniumDriver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_selenium_resolve_element_key_uses_SeleniumElementSelector_for_non_null_contexts
def test_selenium_resolve_element_key_uses_SeleniumElementSelector_for_non_null_contexts(
):
context = Context(Settings())
driver = SeleniumDriver(context)
key = driver.resolve_element_key(context, "Button", "SomethingElse")
expected = "//*[(@name='SomethingElse' or @id='SomethingElse')]"
assert key == expected, "Expected %s, Actual: %s" % (expected, key)
示例2: test_wait_for_disappear
def test_wait_for_disappear():
context = Context(Settings())
selenium_mock = Mock()
selenium_mock.expects(once()).is_element_present(eq('some element')).will(return_value(True))
selenium_mock.expects(once()).is_visible(eq('some element')).will(return_value(False))
driver = SeleniumDriver(context, selenium=selenium_mock)
driver.wait_for_element_to_disappear("some element", 1)
selenium_mock.verify()
示例3: test_selenium_driver_calls_get_eval
def test_selenium_driver_calls_get_eval():
javascript = "some javascript"
context = Context(Settings())
selenium_mock = Mock()
selenium_mock.expects(once()).get_eval(eq(javascript)).will(return_value("ok"))
driver = SeleniumDriver(context, selenium=selenium_mock)
assert driver.exec_js(javascript) == "ok"
示例4: test_wait_for_disappear_works_even_when_is_visible_raises
def test_wait_for_disappear_works_even_when_is_visible_raises():
context = Context(Settings())
selenium_mock = Mock()
selenium_mock.expects(at_least_once()).is_element_present(eq('some element')).will(return_value(True))
selenium_mock.expects(once()).is_visible(eq('some element')).will(raise_exception(Exception("ERROR: Element some element not found")))
driver = SeleniumDriver(context, selenium=selenium_mock)
driver.wait_for_element_to_disappear("some element", 1)
selenium_mock.verify()
示例5: test_selenium_driver_overrides_page_open_properly
def test_selenium_driver_overrides_page_open_properly():
context = Context(Settings())
selenium_mock = Mock()
selenium_mock.expects(once()).open(eq("http://localhost"))
driver = SeleniumDriver(context, selenium=selenium_mock)
driver.page_open("http://localhost")
selenium_mock.verify()
示例6: test_selenium_driver_calls_proper_selenese_on_click_element
def test_selenium_driver_calls_proper_selenese_on_click_element():
context = Context(Settings())
selenium_mock = Mock()
selenium_mock.expects(once()).click(eq("some"))
driver = SeleniumDriver(context, selenium=selenium_mock)
driver.click_element("some")
selenium_mock.verify()
示例7: test_selenium_driver_calls_proper_selenese_on_wait_for_page
def test_selenium_driver_calls_proper_selenese_on_wait_for_page():
context = Context(Settings())
selenium_mock = Mock()
selenium_mock.expects(once()).wait_for_page_to_load(eq(10000))
driver = SeleniumDriver(context, selenium=selenium_mock)
driver.wait_for_page()
selenium_mock.verify()
示例8: test_selenium_driver_overrides_start_test_properly
def test_selenium_driver_overrides_start_test_properly():
context = Context(Settings())
selenium_mock = Mock()
selenium_mock.expects(once()).start()
driver = SeleniumDriver(context, selenium=selenium_mock)
driver.start_test("http://localhost")
selenium_mock.verify()
示例9: test_selenium_driver_calls_proper_selenese_on_stop_test
def test_selenium_driver_calls_proper_selenese_on_stop_test():
context = Context(Settings())
selenium_mock = Mock()
selenium_mock.expects(once()).stop()
driver = SeleniumDriver(context, selenium=selenium_mock)
driver.stop_test()
selenium_mock.verify()
示例10: test_selenium_driver_overrides_start_test_properly_when_extra_args_specified
def test_selenium_driver_overrides_start_test_properly_when_extra_args_specified():
context = Context(Settings())
context.settings.extra_args = {"selenium.server": "localhost", "selenium.port": 4444}
selenium_mock = Mock()
selenium_mock.expects(once()).start()
driver = SeleniumDriver(context, selenium=selenium_mock)
driver.start_test("http://localhost")
selenium_mock.verify()
示例11: test_selenium_driver_calls_proper_selenese_on_get_title
def test_selenium_driver_calls_proper_selenese_on_get_title():
context = Context(Settings())
selenium_mock = Mock()
selenium_mock.expects(once()).get_title().will(return_value("Some title"))
driver = SeleniumDriver(context, selenium=selenium_mock)
title = driver.get_title()
assert title == "Some title"
selenium_mock.verify()
示例12: test_selenium_driver_calls_type_keys
def test_selenium_driver_calls_type_keys():
input_selector = "//some_xpath"
text = "text to type"
context = Context(Settings())
selenium_mock = Mock()
selenium_mock.expects(once()).type_keys(eq(input_selector), eq(text))
driver = SeleniumDriver(context, selenium=selenium_mock)
driver.type_keys(input_selector, text)
selenium_mock.verify()
示例13: test_selenium_driver_overrides_page_open_properly
def test_selenium_driver_overrides_page_open_properly():
mocker = Mocker()
context = Context(Settings())
selenium_mock = mocker.mock()
selenium_mock.open("http://localhost")
with mocker:
driver = SeleniumDriver(context, selenium=selenium_mock)
driver.page_open("http://localhost")
示例14: test_selenium_driver_calls_proper_selenese_on_stop_test
def test_selenium_driver_calls_proper_selenese_on_stop_test():
mocker = Mocker()
context = Context(Settings())
selenium_mock = mocker.mock()
selenium_mock.stop()
with mocker:
driver = SeleniumDriver(context, selenium=selenium_mock)
driver.stop_test()
示例15: test_selenium_driver_overrides_start_test_properly
def test_selenium_driver_overrides_start_test_properly():
mocker = Mocker()
context = Context(Settings())
selenium_mock = mocker.mock()
selenium_mock.start()
with mocker:
driver = SeleniumDriver(context, selenium=selenium_mock)
driver.start_test("http://localhost")