Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(SelectorType.tag_name, "h2", "Title Here"),
(SelectorType.xpath, ".//h2", "Title Here"),
],
)
async def test_selector_types(session, using, selector, result):
await session.get("/selectors/")
element = await session.wait_for_element(5, selector, using)
assert result == await element.get_text()
(SelectorType.css_selector, ".classname", "Class Name"),
(SelectorType.link_text, "link text", "link text"),
(SelectorType.partial_link_text, "partial", "partial link text"),
(SelectorType.tag_name, "h2", "Title Here"),
(SelectorType.xpath, ".//h2", "Title Here"),
],
)
async def test_selector_types(session, using, selector, result):
await session.get("/selectors/")
element = await session.wait_for_element(5, selector, using)
assert result == await element.get_text()
async def get_elements(
self, selector: str, selector_type: SelectorType = SelectorType.css_selector
) -> List["Element"]:
element_ids = await self._request(
url="/elements",
method="POST",
data={"using": selector_type.value, "value": selector},
)
return [self.session.create_element(element_id) for element_id in element_ids]
async def get_element(
self, selector: str, selector_type: SelectorType = SelectorType.css_selector
) -> "Element":
element_id = await self._request(
url="/element",
method="POST",
data={"using": selector_type.value, "value": selector},
)
return self.session.create_element(element_id)