Skip to content

Commit

Permalink
Merge pull request #1867 from yuriverweij/bugfix/failing_page_should_…
Browse files Browse the repository at this point in the history
…contain_element_with_list

added fix for Page Should Contain Element not accepting lists
  • Loading branch information
yuriverweij committed May 3, 2024
2 parents 473c5d4 + 9d80090 commit 7d8295b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions atest/acceptance/locators/locator_parsing.robot
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/SeleniumLibrary/keywords/element.py
Expand Up @@ -149,7 +149,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,
Expand Down

0 comments on commit 7d8295b

Please sign in to comment.