Verification of Field Focus After 'Tab' Key

I’m looking to verify that my page has the correct tab order. I checked this post, and while similar, I don’t think it’s what I’m wanting to do:

After tabbing out of ‘Field01’, ‘Field02’ should have focus, but I don’t want to do a WebUI.focus. I’ve set the text and pressed the Tab key using:

import org.openqa.selenium.Keys as Keys
WebUI.sendKeys(findTestObject(‘Field01’), Keys.chord(‘text input’, Keys.TAB))

How would I verify that ‘Field02’ has focus now?

Take a look at this:

You can probably achieve this using JavaScript.


maybe these could help you
//returns the currently focused element

//switch back after using

or with this one line