Reputation: 23
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?
Upvotes: 2
Views: 2065
Reputation: 385870
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(...):
...
Upvotes: 1