diff --git a/atest/acceptance/locators/locator_parsing.robot b/atest/acceptance/locators/locator_parsing.robot index 3ae3a59aa..2efb1586f 100644 --- a/atest/acceptance/locators/locator_parsing.robot +++ b/atest/acceptance/locators/locator_parsing.robot @@ -47,6 +47,15 @@ Multiple Locators with double arrows as separator should work Multiple Locators strategy should be case-insensitive Page Should Contain Element cSs=div#div_id >> XpaTh=a[6] >> iD=image1_id +Multiple Locators as a List should work + ${element} = Get WebElement id:foo:bar + ${locator_list} = Create List id:div_id ${element} id:bar=foo + Page Should Contain Element ${locator_list} + +WebElement as locator should work + ${element} = Get WebElement id:foo:bar + Page Should Contain Element ${element} + When One Of Locator From Multiple Locators Is Not Found Keyword Fails Run Keyword And Expect Error ... Element with locator 'id:not_here' not found. diff --git a/src/SeleniumLibrary/keywords/element.py b/src/SeleniumLibrary/keywords/element.py index d277791f5..b2fef7eb7 100644 --- a/src/SeleniumLibrary/keywords/element.py +++ b/src/SeleniumLibrary/keywords/element.py @@ -143,7 +143,7 @@ def page_should_contain(self, text: str, loglevel: str = "TRACE"): @keyword def page_should_contain_element( self, - locator: Union[WebElement, str], + locator: Union[WebElement, str, List[Union[WebElement,str]]], message: Optional[str] = None, loglevel: str = "TRACE", limit: Optional[int] = None,