package org.getopentest.selenium;

import org.getopentest.annotations.TestActionClass;
import org.getopentest.selenium.core.ElementWrapper;
import org.getopentest.selenium.core.SeleniumTestAction;
import org.openqa.selenium.WebElement;

@TestActionClass(description = "Returns the currently focused UI element.")

public class GetActiveElement extends SeleniumTestAction {

    @Override
    public void run() {
        super.run();

        this.waitForAsyncCallsToFinish();

        WebElement activeElement = driver.switchTo().activeElement();
        
        this.writeOutput("element", new ElementWrapper(activeElement));
    }
}
