Search in sources :

Example 71 with PublicAtsApi

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

the class SwingSingleSelectList method getValue.

/**
     * Get SingleSelectList value
     *
     * @throws VerificationException if the element doesn't exist
     */
@Override
@PublicAtsApi
public String getValue() {
    new SwingElementState(this).waitToBecomeExisting();
    String[] selections = ((JListFixture) SwingElementLocator.findFixture(this)).selection();
    if (selections.length > 0) {
        return selections[0];
    }
    return "";
}
Also used : JListFixture(org.fest.swing.fixture.JListFixture) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 72 with PublicAtsApi

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

the class SwingSingleSelectList method setValue.

/**
     * Set SingleSelectList value
     *
     * @param value the value to set
     * @throws VerificationException if the element doesn't exist
     */
@Override
@PublicAtsApi
public void setValue(String value) {
    new SwingElementState(this).waitToBecomeExisting();
    ((JListFixture) SwingElementLocator.findFixture(this)).selectItem(value);
}
Also used : JListFixture(org.fest.swing.fixture.JListFixture) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 73 with PublicAtsApi

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

the class SwingSingleSelectList method clearSelection.

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

Example 74 with PublicAtsApi

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

the class MobileElement method clickIfExists.

//    public T click() {
//
//        new MobileElementState( this ).waitToBecomeExisting();
//
//        try {
//            try {
//                MobileElementFinder.findElement( appiumDriver, this ).click();
//            } catch( ElementNotVisibleException enve ) { // element is not currently visible and may not be manipulated
//
//                new MobileElementState( this ).waitToBecomeDisplayed();
//                MobileElementFinder.findElement( appiumDriver, this ).click();
//            }
//            return ( T ) this;
//        } catch( Exception e ) {
//            throw new MobileOperationException( this, "click", e );
//        }
//    }
/**
     * Click/tap the element if exists.
     *
     * @param waitingTimeout timeout in milliseconds to wait for the element to appear
     */
@PublicAtsApi
public boolean clickIfExists(int waitingTimeout) {
    int currentStateChangeDelay = UiEngineConfigurator.getInstance().getElementStateChangeDelay();
    try {
        UiEngineConfigurator.getInstance().setElementStateChangeDelay(waitingTimeout);
        appiumDriver.manage().timeouts().implicitlyWait(waitingTimeout, TimeUnit.MILLISECONDS);
        long endTime = System.currentTimeMillis() + waitingTimeout;
        new MobileElementState(this).waitToBecomeExisting();
        // the element exists but may be still not clickable
        do {
            try {
                MobileElementFinder.findElement(appiumDriver, this).click();
                return true;
            } catch (Exception e) {
            }
            UiEngineUtilities.sleep(500);
        } while (endTime - System.currentTimeMillis() > 0);
    } catch (VerificationException ve) {
    // do nothing, the element doesn't exist
    } finally {
        UiEngineConfigurator.getInstance().setElementStateChangeDelay(currentStateChangeDelay);
        appiumDriver.manage().timeouts().implicitlyWait(currentStateChangeDelay, TimeUnit.MILLISECONDS);
    }
    return false;
}
Also used : VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) MobileOperationException(com.axway.ats.uiengine.exceptions.MobileOperationException) VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) MobileElementState(com.axway.ats.uiengine.utilities.mobile.MobileElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 75 with PublicAtsApi

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

the class SwingMenuItem method click.

/**
     * Click menu item
     * @throws VerificationException if the element doesn't exist
     */
@Override
@PublicAtsApi
public void click() {
    new SwingElementState(this).waitToBecomeExisting();
    ((JMenuItemFixture) SwingElementLocator.findFixture(this)).click();
}
Also used : SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) JMenuItemFixture(org.fest.swing.fixture.JMenuItemFixture) 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