I am doing some WebUI testing with katalong studio v9.6.0
But i am facing issue in verifyign the tab navigation order of website.
Steps which i want to do:
Open a site
Press TAB key and verify the focused element.
Again press the TAB key and verify the 2nd focused element.
I am opening the site with the open browser keyword and then i have added the below step
WebUI.sendKeys(Body_ob, Keys.chord(Keys.TAB))
I’m not what to provide in place of the Body_obj test object.
Pls help me to verify the Focused element using TAB key and the TAB navigation order.
I have added the step. You can pick any website lets say www.google.com
Then press TAB button and get the Focused Element.
Again press the TAB button and get the Focused Element.
So there’s always an order for the TAB navigation.
Also you may need to get some of your object’s attributes so you can compare with, attribId = element.getAttribute('id')
or/and
attribClass = element.getAttribute('class')
Maybe with the above, as well as the tag, you could “build” a pathway to the object and have it “flash”, if there is no outward indication of which element you “tabbed” to.
Maybe:
/**
* Put a highlight around the Web Element
* @param to = our web element
*/
@Keyword
public static highlightElement(WebElement element){
try {
WebUI.executeJavaScript("arguments[0].setAttribute('style', 'background: yellow; border: 2px solid red;');", Arrays.asList(element))
WebUI.delay(0.5)
WebUI.executeJavaScript("arguments[0].setAttribute('style','border: solid 2px white');", Arrays.asList(element))
} catch (Exception) {
WebUI.comment("Could not find 'element'")
}
}