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

com.shaft.dsl.gui.RadioButton Maven / Gradle / Ivy

Go to download

SHAFT is a unified test automation engine. Powered by best-in-class frameworks, SHAFT provides a wizard-like syntax to drive your automation efficiently, maximize your ROI, and minimize your learning curve. Stop reinventing the wheel. Upgrade now!

There is a newer version: 8.2.20240402
Show newest version
package com.shaft.dsl.gui;

import com.shaft.validation.Validations;
import org.openqa.selenium.By;


@SuppressWarnings("unused")
public class RadioButton extends Button {
    public static final String SELECTED = "selected";
    final By selectedLocator;

    public RadioButton(By buttonLocator, By selectedLocator) {
        super(buttonLocator);
        this.selectedLocator = selectedLocator;
    }

    public void select() {
        if (!(isSelected())) {
            click();
        }
    }

    public void unselect() {
        if ((isSelected())) {
            click();
        }
    }

    public boolean isSelected() {
        return (elementActions.getAttribute(selectedLocator, SELECTED) != null);
    }

    public void shouldBeSelected() {
        Validations.assertThat().object(isSelected()).isTrue().perform();
    }

    public void shouldBeSelected(String reportMsg) {
        Validations.assertThat().object(isSelected()).isTrue().withCustomReportMessage(reportMsg).perform();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy