Skip to content

Commit 7d8295b

Browse files
authored
Merge pull request #1867 from yuriverweij/bugfix/failing_page_should_contain_element_with_list
added fix for Page Should Contain Element not accepting lists
2 parents 473c5d4 + 9d80090 commit 7d8295b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

atest/acceptance/locators/locator_parsing.robot

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ Multiple Locators with double arrows as separator should work
4747
Multiple Locators strategy should be case-insensitive
4848
Page Should Contain Element cSs=div#div_id >> XpaTh=a[6] >> iD=image1_id
4949

50+
Multiple Locators as a List should work
51+
${element} = Get WebElement id:foo:bar
52+
${locator_list} = Create List id:div_id ${element} id:bar=foo
53+
Page Should Contain Element ${locator_list}
54+
55+
WebElement as locator should work
56+
${element} = Get WebElement id:foo:bar
57+
Page Should Contain Element ${element}
58+
5059
When One Of Locator From Multiple Locators Is Not Found Keyword Fails
5160
Run Keyword And Expect Error
5261
... Element with locator 'id:not_here' not found.

src/SeleniumLibrary/keywords/element.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def page_should_contain(self, text: str, loglevel: str = "TRACE"):
149149
@keyword
150150
def page_should_contain_element(
151151
self,
152-
locator: Union[WebElement, str],
152+
locator: Union[WebElement, str, List[Union[WebElement,str]]],
153153
message: Optional[str] = None,
154154
loglevel: str = "TRACE",
155155
limit: Optional[int] = None,

0 commit comments

Comments
 (0)