0

In Robot Framework, is it possible to get the WebDriver instance from the Selenium2library and use it in Python code? What I wanna do is extend the Selenium2Library with some custom functions. But I need the WebDriver instance to do that.

2
  • 1
    Selenium2Library is very old and unsupported. Is there a reason you're using it rather than the newer SeleniumLibrary? Commented Mar 12, 2021 at 23:50
  • @BryanOakley no reason, i'm pretty new to Robot framework and i thought SeleniumTWO was the new library :D I didn't specifiy any library in my robot file so I assume it's using the SeleniumLibrary then Commented Mar 13, 2021 at 8:03

1 Answer 1

3

Selenium2Library is no longer supported. The newest version of robot's selenium library is SeleniumLibrary. If you are using SeleniumLibrary rather than the outdated Selenium2Library, you can access the actual webdriver instance like so:

from robot.libraries.BuiltIn import BuiltIn selib = BuiltIn().get_library_instance("SeleniumLibrary") driver = selib.driver 

This is documented in the SeleniumLibrary source code repository in the file docs/extending/extending.rst

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.