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.
0
votes
Selenium2Library is very old and unsupported. Is there a reason you're using it rather than the newer SeleniumLibrary?
- Bryan Oakley
@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
- Mario92
1 Answers
2
votes
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