Search in sources :

Example 1 with NoSuchElementException

use of org.openqa.selenium.NoSuchElementException in project android by owncloud.

the class Actions method shareLinkElementByGmail.

public static AndroidElement shareLinkElementByGmail(String elementName, FileListView fileListView, AndroidDriver driver, Common common) throws Exception {
    try {
        //To open directly the "file list view" and
        //we don't need to know in which view we are
        driver.startActivity("com.owncloud.android", ".ui.activity.FileDisplayActivity");
        ElementMenuOptions menuOptions = fileListView.longPressOnElement(elementName);
        ShareView shareView = menuOptions.clickOnShareLinkElement();
        Actions.scrollTillFindElement("Gmail", shareView.getListViewLayout(), driver).click();
        GmailSendMailView gmailSendMailView = new GmailSendMailView(driver);
        gmailSendMailView.typeToEmailAdress(Config.gmailAccount);
        gmailSendMailView.clickOnSendButton();
        Common.waitTillElementIsNotPresentWithoutTimeout(fileListView.getProgressCircular(), 1000);
        common.wait.until(ExpectedConditions.visibilityOf(fileListView.getFileElementLayout().findElement(By.id(FileListView.getSharedElementIndicator()))));
    } catch (NoSuchElementException e) {
        return null;
    }
    return (AndroidElement) fileListView.getFileElementLayout().findElement(By.id(FileListView.getSharedElementIndicator()));
}
Also used : ShareView(com.owncloud.android.test.ui.models.ShareView) ElementMenuOptions(com.owncloud.android.test.ui.models.ElementMenuOptions) GmailSendMailView(com.owncloud.android.test.ui.models.GmailSendMailView) AndroidElement(io.appium.java_client.android.AndroidElement) NoSuchElementException(org.openqa.selenium.NoSuchElementException)

Example 2 with NoSuchElementException

use of org.openqa.selenium.NoSuchElementException in project android by owncloud.

the class Actions method login.

public static FileListView login(String url, String user, String password, Boolean isTrusted, AndroidDriver driver) throws InterruptedException {
    LoginForm loginForm = new LoginForm(driver);
    CertificatePopUp certificatePopUp = loginForm.typeHostUrl(url);
    if (!isTrusted) {
        WebDriverWait wait = new WebDriverWait(driver, 30);
        //and it doesn't appear again
        try {
            wait.until(ExpectedConditions.visibilityOf(certificatePopUp.getOkButtonElement()));
            //we need to repaint the screen 
            //because of some element are misplaced
            driver.rotate(ScreenOrientation.LANDSCAPE);
            driver.rotate(ScreenOrientation.PORTRAIT);
            certificatePopUp.clickOnOkButton();
        } catch (NoSuchElementException e) {
        }
    }
    loginForm.typeUserName(user);
    loginForm.typePassword(password);
    //TODO. Assert related to check the connection?
    return loginForm.clickOnConnectButton();
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) CertificatePopUp(com.owncloud.android.test.ui.models.CertificatePopUp) LoginForm(com.owncloud.android.test.ui.models.LoginForm) NoSuchElementException(org.openqa.selenium.NoSuchElementException)

Example 3 with NoSuchElementException

use of org.openqa.selenium.NoSuchElementException in project android by owncloud.

the class Actions method scrollTillFindElement.

public static AndroidElement scrollTillFindElement(String elementName, AndroidElement element, AndroidDriver driver) {
    AndroidElement fileElement;
    if (element.getAttribute("scrollable").equals("true")) {
        HashMap<String, String> scrollObject = new HashMap<String, String>();
        scrollObject.put("text", elementName);
        scrollObject.put("element", ((RemoteWebElement) element).getId());
        driver.executeScript("mobile: scrollTo", scrollObject);
    }
    try {
        fileElement = (AndroidElement) driver.findElementByName(elementName);
    } catch (NoSuchElementException e) {
        fileElement = null;
    }
    return fileElement;
}
Also used : HashMap(java.util.HashMap) AndroidElement(io.appium.java_client.android.AndroidElement) NoSuchElementException(org.openqa.selenium.NoSuchElementException)

Example 4 with NoSuchElementException

use of org.openqa.selenium.NoSuchElementException in project android by owncloud.

the class Common method assertIsNotInFileListView.

protected void assertIsNotInFileListView() throws InterruptedException {
    AndroidElement fileElement;
    assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector()" + ".resourceId(\"android:id/action_bar_title\")")));
    try {
        fileElement = (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector()" + ".description(\"Upload\")");
    } catch (NoSuchElementException e) {
        fileElement = null;
    }
    assertNull(fileElement);
}
Also used : AndroidElement(io.appium.java_client.android.AndroidElement) NoSuchElementException(org.openqa.selenium.NoSuchElementException)

Example 5 with NoSuchElementException

use of org.openqa.selenium.NoSuchElementException in project selenium-tests by Wikia.

the class VisualEditorAddMapDialog method addExistingMap.

public VisualEditorPageObject addExistingMap(int number) {
    waitForDialogVisible();
    WebElement mediaResultsWidget = mediaDialogBody.findElement(mediaResultsWidgetBy);
    if (isElementOnPage(mediaResultsWidget)) {
        wait.forElementVisible(mediaResultsWidget);
        List<WebElement> maps = mediaResultsWidget.findElements(mediaResultsBy);
        WebElement map = maps.get(number);
        map.click();
    } else {
        throw new NoSuchElementException("The dialog is in empty state, the wiki needs to contain map.");
    }
    waitForDialogNotVisible();
    return new VisualEditorPageObject();
}
Also used : VisualEditorPageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.visualeditor.VisualEditorPageObject) WebElement(org.openqa.selenium.WebElement) NoSuchElementException(org.openqa.selenium.NoSuchElementException)

Aggregations

NoSuchElementException (org.openqa.selenium.NoSuchElementException)140 WebElement (org.openqa.selenium.WebElement)83 Test (org.junit.Test)30 TimeoutException (org.openqa.selenium.TimeoutException)21 MessageEvent (org.cerberus.engine.entity.MessageEvent)20 WebDriverException (org.openqa.selenium.WebDriverException)18 Select (org.openqa.selenium.support.ui.Select)13 AnswerItem (org.cerberus.util.answer.AnswerItem)11 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)11 AndroidElement (io.appium.java_client.android.AndroidElement)10 BFElementNotFoundException (com.capgemini.ntc.selenium.core.exceptions.BFElementNotFoundException)9 ElementMenuOptions (com.owncloud.android.test.ui.models.ElementMenuOptions)8 By (org.openqa.selenium.By)8 WaitAMomentPopUp (com.owncloud.android.test.ui.models.WaitAMomentPopUp)6 Identifier (org.cerberus.engine.entity.Identifier)6 Actions (org.openqa.selenium.interactions.Actions)6 Matcher (java.util.regex.Matcher)5 CerberusEventException (org.cerberus.exception.CerberusEventException)5 FailingTestCategory (com.owncloud.android.test.ui.groups.FailingTestCategory)4 ShareView (com.owncloud.android.test.ui.models.ShareView)4