Keyword code unable to detect form element that is present

Hi all,

I have an issue here that I have been unable to figure out…I am using v 7.5.5

In my test case I have a Verify Element Present which successfully appears to validate that my form element is present = good!

I am then having to call a method in a custom keyword which needs to get that form element in order to do other stuff which is commented out.

But my custom keyword code is failing to get the form element even though I am passing in the TestObject I used to detect its presence earlier. This is the code that is failing:

@Keyword
def WebElement GetFilterForm(TestObject form) {
WebElement formElement = WebUiBuiltInKeywords.findWebElement(form)
return formElement
}

I just keep getting the following:
WebElementNotFoundException: Web element with id: ‘Object Repository/BC/Graphite/Common/_Filtering/FilterForm’ located by ‘By.xpath: //*[@id=“page_content”]/form’ not found

The form is inside an iframe and that iframe is correctly referenced and working as demonstrated by the Verify Element Present so I am totally confused right now.

I do not believe it is an import problem as all of the imports are left alone after using KS to create the keyword helpers file for me.

Any thoughts appreciated.

get-form-element-keyword-method test-case

Well I have got this to work by ignoring the TestObject and WebBuildInKeywords and going with using the DriverFactory and hitting selenium directly:

@Keyword
def WebElement GetFilterForm(TestObject form) {
WebDriver driver = DriverFactory.getWebDriver()
driver.switchTo().frame(“mk_main”);
WebElement formElement = driver.findElement(By.xpath("//*[@id=‘page_content’]/form"))
return formElement
}

I still think this is something to do with switching frame that I had hoped would be automatic in my previous attempts by passing the TestObject but this will do for now. Will have another look at it when I get more time.