def test_target_path_shadow_by_xpath():
    path = TargetPath.shadow(By.XPATH, "//x")

    assert type(path) is ShadowDomLocator
    assert path.by is By.XPATH
    assert path.selector == "//x"
    assert path.parent is None
def test_target_path_shadow_by_css():
    path = TargetPath.shadow(".css")

    assert type(path) is ShadowDomLocator
    assert path.by is By.CSS_SELECTOR
    assert path.selector == ".css"
    assert path.parent is None
Exemplo n.º 3
0
def test_transformed_selector_convert_shadow_by_css_region_by_css():
    converted = TransformedSelector.convert(
        True,
        TargetPath.shadow("#s").region(".css"))

    assert converted.type is By.CSS_SELECTOR
    assert converted.selector == "#s"
    assert converted.frame is None
    assert type(converted.shadow) is TransformedSelector
    assert converted.shadow.type is By.CSS_SELECTOR
    assert converted.shadow.selector == ".css"
    assert converted.shadow.frame is None
    assert converted.shadow.shadow is None
def test_target_path_shadow_css_repr():
    path = TargetPath.shadow(".css")

    assert repr(path) == "TargetPath.shadow('.css')"
def test_target_path_shadow_css_region_css_repr():
    path = TargetPath.shadow("#shadow").region(".region")

    assert repr(path) == "TargetPath.shadow('#shadow').region('.region')"
def test_target_path_shadow_xpath_repr():
    path = TargetPath.shadow(By.XPATH, "//x")

    assert repr(path) == "TargetPath.shadow(By.XPATH, '//x')"