com.shaft.dsl.gui.RadioButton Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of SHAFT_ENGINE Show documentation
Show all versions of SHAFT_ENGINE Show documentation
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!
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();
}
}