问题
I try to use this method
def my_click(self, locator, info="click on button error", timeout=5):
element = self.wait_for_visibility(locator, info, timeout)
element.click()
def wait_for_visibility(self, locator, info="no error", timeout=10):
return WebDriverWait(self.get_driver(), timeout).until(
expected_conditions.visibility_of_element_located(locator), info)
inside robot framework file
Register Proper Data
[Setup] Open Browser ${web-page} browser=${browser}
my click (By.PARTIAL_LINK_TEXT, "register")
but the program returns:
TypeError: find_element() takes at most 3 arguments (35 given) - which is the number of letters in the argument
Why is it happening? How to pass arguments to a keyword?
回答1:
Why my click argument is in brackets? It should be without brackets and comma. Something like:
my click By.PARTIAL_LINK_TEXT register
Please ensure that there are 3-4 spaces between the function and the variables and each variable.
来源:https://stackoverflow.com/questions/45288576/python-robot-framework-pass-arguments-to-a-function