All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.yandex.qatools.actions.beans.AbstractSelectRadioButtonAction Maven / Gradle / Ivy

The newest version!
package ru.yandex.qatools.actions.beans;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import ru.yandex.qatools.htmlelements.element.Radio;

/**
 * @author Alexander Tolmachev [email protected]
 *         Date: 11.07.12
 */
public abstract class AbstractSelectRadioButtonAction extends WebElementAction {

    public abstract int getButtonIndex();

    @Override
    public void perform(WebDriver webDriver) {
        WebElement radioButton = webDriver.findElement(buildBy());
        Radio radio = new Radio(radioButton);
        radio.selectByIndex(getButtonIndex());
    }

    @Override
    public String toString() {
        return String.format("Select radio button number %d from radio group '%s'",
                getButtonIndex(), buildBy());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy