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: http://forum.katalon.com/t/focus-verification/9752

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.

hi,

maybe these could help you
//returns the currently focused element
driver.switchTo().activeElement();

//switch back after using
driver.switchTo().defaultContent();

or with this one line

element.equals(driver.switchTo().activeElement());