2
votes

I try to use a custom keyword by inherating selenium2library. I've define this keyword in a .py file :


from Selenium2Library import Selenium2Library
class TestLibrary(Selenium2Library):
    def storm_click(self, locator):
        submit_button = self._current_browser().find_element_by_class_name(locator)
        submit_button.click()

I have imported this custom keyword in my .robot test file using Library import:

*** Settings ***

Library  TestLibrary.py

When I execute robot

 robot tests/livestorm.robot 

I've got this issue:

No keyword with name 'storm click' found.

Have you any idea ton explain why robot framework don't find my custom keyword?

1
In which folder TestLibrary.py is placed?JaPyR
What version of Selenium2Library are you using? Are you using the one based on SeleniumLibrary?Bryan Oakley

1 Answers

1
votes

You are apparently using version 3 or greater of SeleniumLibrary. According to the documentation for extending the library, you must use the @keyword decorator for a method to be recognized as a keyword:

...
from SeleniumLibrary.base import keyword
...
class TestLibrary(Selenium2Library):
    @keyword
    def storm_click(...):
        ...