Skip to content

Chaining locators with lists does not work with Robot Framework 6.1 or above #1962

Closed

Description

@jjaakkola-atostek

Giving chained locator as a list of locators seems not to work since Robot Framework 6.1.0. Tested with Chrome and Firefox using test web page and test case given below. The first chained locator with >> finds the element, but latter with list does not . With Robot Framework 6.0.1 works fine. Tested also with RF 7.4.1 and not working.

I did some research in the SeleniumLibrary's code, and problem seems to be with the type annotations of the keywords. For example:

def click_element(
        self,
        locator: Union[WebElement, str],
        modifier: Union[bool, str] = False,
        action_chain: bool = False,
    ):

locator's type annotation should be `Union[WebElement, str, list]´. If I chance that, my test code passes.

Software and versions

SeleniumLibrary: 6.8.0
Robot Framework: 6.1 and 7.4.1
robotframework-pythonlibcore: 4.5.0
Python: 3.11.9
Chrome: 143.0.7499.171
ChromeDriver: 143.0.7499.40
Firefox: 147.0.1
Gecko Driver: 0.36.0

Example HTML

<html>
	<head>
		<title>Locator Chain Test</title>
	</head>
	<body>
		<button id="testElement">This is a test</button>
	</body>
</html>

Example test case

*** Settings ***
Library	SeleniumLibrary

*** Test Cases ***
Locator Chain Test
	Open Browser		[test_file_path]	chrome
	Click Element		tag:body >> id:testElement
	${locator_chain}	Create List	tag:body	id:testElement
	Click Element		${locator_chain}

Activity

  1. self-assigned this
    on Jan 19, 2026
  2. emanlove commented on Jan 19, 2026

    @emanlove
    Member

    Will take a look this morning. What version of pythonlibcore (robotframework-pythonlibcore) are you running? The latest is 4.5.0 released just this past week.

  3. jjaakkola-atostek commented on Jan 19, 2026

    @jjaakkola-atostek
    Author

    Thank you! robotframework-pythonlibcore version is 4.5.0. I added it to the description.

  4. emanlove commented on Jan 19, 2026

    @emanlove
    Member

    I think I am seeing the problem and yes it apopears to be the type annotation. I was temporarily confused because I know we had a test for this which was passing. Looking at the code who have just the one specific test, which should be good enough, but it was just the one keyword it uses, Page Should Contain Element, that has the type annotations fixed. Looks like most if not all other keywords with locators do not ..

    Working on a solution now. Thanks for pointing this out @jjaakkola-atostek !

  5. added this to the Jan 2026 milestone on Apr 26, 2026
  6. emanlove commented on Apr 26, 2026

    @emanlove
    Member

    Fixed in #1972

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions