package org.getopentest.selenium;

import org.getopentest.selenium.core.SeleniumTestAction;
import org.openqa.selenium.By;

public class ReadElementText extends SeleniumTestAction {

    @Override
    public void run() {
        super.run();
        
        By locator = this.readLocatorArgument("locator");
        
        this.waitForAsyncCallsToFinish();
        
        String elementText = this.getElement(locator).getText();
        
        this.writeOutput("text", elementText);
        
        // The output "value" is deprecated in favor of "text",
        // and will eventually be removed
        this.writeOutput("value", elementText);
    }
}
