Provides documentation for calling the seleniumLibrary using Python code

Hiiiii!
I want to use Python to call the seleniumLibrary to build the test project, and I want to maintain it as code. But I searched in all the search engines, can find very few cases.
I wonder if RobotFramework can support this feature? Looking forward to your reply, thank you!

Hi

Calling SeleniumLibrary from Python is possible and there are many ways to do it. What SeleniumLibrary supports is mostly explained in here: SeleniumLibrary/extending.rst at master · robotframework/SeleniumLibrary · GitHub

1 Like

Documentation for builtin robotframework library has example of how to do this at @ https://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Get%20Library%20Instance

def title_should_start_with(expected):
    seleniumlib = BuiltIn().get_library_instance('SeleniumLibrary')
    title = seleniumlib.get_title()
    if not title.startswith(expected):
        raise AssertionError("Title '%s' did not start with '%s'"
                             % (title, expected))

2 Likes

Ok, thank you. I’m learning more about it

Ok, thank you. I see. I’m learning more about it