Hello,
I’m trying to face to following problem:
I’ve written a TestCase in which I use a CustomKeyword A to test a Table represented by a WebElement.
TestCase
WebDriver driver = DriverFactory.getWebDriver()
WebElement table = driver.findElement(By.id(‘elementA’))
CustomKeywords.A.testMyElement(table)
That works properly so far. Inside of Keyword A I call a method of Keyword B and try to pass table as an argument.
Keyword A
@Keyword
def testMyElement(WebElement table){
int n = B.getNum(table)
// Alternative
// int n = B.getNum((RemoteWebElement) table)
}
Keyword B
@Keyword
def getNum(WebElement table){
// fency
}
This causes a groovy.lang.MissingMethodException:
No signature of method: static B.getNum() is applicable for argument types: (org.openqa.selenium.remote.RemoteWebElement) values: [[[ExistingRemoteWebDriver: on ANY (0f59c1c1cbf9f75d05c48816884cc0d3)] → id: elementA]]
Possible solutions: getTotalAmountOfRows(org.openqa.selenium.remote.RemoteWebElement)
I tried to cast table to RemoteWebElement but that didn’t help. And it didn’t help to change the Argument Type at getNum() from WebElement to RemoteWebElement as well.
Is it possible to pass WebElements through Keywords in general? Waht could solve my problem?