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()));
}
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();
}
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;
}
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);
}
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();
}
Aggregations