Search in sources :

Example 51 with PublicAtsApi

use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.

the class SwingCheckBox method unCheck.

/**
     * Uncheck the CheckBox
     * @throws VerificationException if the element doesn't exist
     */
@Override
@PublicAtsApi
public void unCheck() {
    new SwingElementState(this).waitToBecomeExisting();
    ((JCheckBoxFixture) SwingElementLocator.findFixture(this)).uncheck();
}
Also used : SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) JCheckBoxFixture(org.fest.swing.fixture.JCheckBoxFixture) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 52 with PublicAtsApi

use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.

the class SwingComboBox method setValue.

/**
     * Set ComboBox value
     * @param value the ComboBox value to set
     * @throws VerificationException if the element doesn't exist
     */
@SuppressWarnings("unchecked")
@Override
@PublicAtsApi
public void setValue(String value) {
    new SwingElementState(this).waitToBecomeExisting();
    JComboBoxFixture comboBoxFixture = null;
    try {
        comboBoxFixture = ((JComboBoxFixture) SwingElementLocator.findFixture(this));
        comboBoxFixture.selectItem(value);
    } catch (LocationUnavailableException lue) {
        // if the element is editable we'll enter the new value
        if (comboBoxFixture != null && comboBoxFixture.component().isEditable()) {
            try {
                comboBoxFixture.component().addItem(value);
                comboBoxFixture.selectItem(value);
            } catch (LocationUnavailableException e) {
                throw new UiElementException(e.getMessage(), this);
            }
        } else {
            throw new UiElementException(lue.getMessage(), this);
        }
    }
}
Also used : JComboBoxFixture(org.fest.swing.fixture.JComboBoxFixture) LocationUnavailableException(org.fest.swing.exception.LocationUnavailableException) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 53 with PublicAtsApi

use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.

the class SwingComponent method doubleClick.

/**
     * Simulates a user double click over the GUI component.
     *
     */
@PublicAtsApi
public void doubleClick() {
    new SwingElementState(this).waitToBecomeExisting();
    click(MouseClickInfo.leftButton().times(2));
}
Also used : SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 54 with PublicAtsApi

use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.

the class SwingComponent method drag.

/**
     * Simulates a user dragging of this component
     *
     */
@PublicAtsApi
public void drag() {
    new SwingElementState(this).waitToBecomeExisting();
    ComponentFixture<? extends Component> componentFixture = SwingElementLocator.findFixture(this);
    ComponentDragAndDrop componentDragAndDrop = new ComponentDragAndDrop(componentFixture.robot);
    componentDragAndDrop.drag(componentFixture.target, getComponentCenterLocation(componentFixture.target));
}
Also used : ComponentDragAndDrop(org.fest.swing.core.ComponentDragAndDrop) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 55 with PublicAtsApi

use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.

the class RealHtmlTable method getColumnCount.

/**
     * @return how many columns this table has
     */
@PublicAtsApi
public int getColumnCount() {
    new RealHtmlElementState(this).waitToBecomeExisting();
    String css = this.getElementProperty("_css");
    try {
        if (!StringUtils.isNullOrEmpty(css)) {
            StringBuilder sb = new StringBuilder(css);
            sb.append(" tr:nth-child(1) td");
            int count = webDriver.findElements(By.cssSelector(sb.toString())).size();
            sb = new StringBuilder(css);
            sb.append(" tr:nth-child(1) th");
            count += webDriver.findElements(By.cssSelector(sb.toString())).size();
            return count;
        } else {
            // get elements matching the following xpath
            return this.webDriver.findElements(By.xpath("(" + properties.getInternalProperty(HtmlElementLocatorBuilder.PROPERTY_ELEMENT_LOCATOR) + "//tr[th or td])[1]/*")).size();
        }
    } catch (Exception e) {
        throw new SeleniumOperationException(this, "getColumnsCount", e);
    }
}
Also used : RealHtmlElementState(com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState) SeleniumOperationException(com.axway.ats.uiengine.exceptions.SeleniumOperationException) SeleniumOperationException(com.axway.ats.uiengine.exceptions.SeleniumOperationException) VerifyNotEqualityException(com.axway.ats.uiengine.exceptions.VerifyNotEqualityException) VerifyEqualityException(com.axway.ats.uiengine.exceptions.VerifyEqualityException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

PublicAtsApi (com.axway.ats.common.PublicAtsApi)409 Validator (com.axway.ats.core.validation.Validator)66 SwingElementState (com.axway.ats.uiengine.utilities.swing.SwingElementState)60 WebElement (org.openqa.selenium.WebElement)57 IFileSystemOperations (com.axway.ats.core.filesystem.model.IFileSystemOperations)44 HiddenHtmlElementState (com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState)32 NoSuchMimePackageException (com.axway.ats.action.objects.model.NoSuchMimePackageException)31 PackageException (com.axway.ats.action.objects.model.PackageException)31 RealHtmlElementState (com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState)31 MessagingException (javax.mail.MessagingException)31 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)24 ArrayList (java.util.ArrayList)18 SeleniumOperationException (com.axway.ats.uiengine.exceptions.SeleniumOperationException)16 UiElementException (com.axway.ats.uiengine.exceptions.UiElementException)16 IOException (java.io.IOException)16 JTableFixture (org.fest.swing.fixture.JTableFixture)16 Actions (org.openqa.selenium.interactions.Actions)16 NotSupportedOperationException (com.axway.ats.uiengine.exceptions.NotSupportedOperationException)15 VerifyNotEqualityException (com.axway.ats.uiengine.exceptions.VerifyNotEqualityException)15 XMLException (com.axway.ats.common.xml.XMLException)14