List of usage examples for org.openqa.selenium By name
public static By name(String name)
From source file:com.qkn.automation.pages.LoginPage.java
public void loginWithValidCredentialsForIos(String email, String password) throws Exception { try {/*from ww w .j a va2s . com*/ Thread.sleep(5000); WebDriverWait wait = new WebDriverWait(pageDriver, 120); /*if (pageDriver.getPageSource().contains("Ignore")){ wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(pageprops.getProperty("APP_UPGRADE_POPUP")))); pageDriver.findElement(By.xpath(pageprops.getProperty("APP_UPGRADE_POPUP"))).click();}*/ wait.until(ExpectedConditions.visibilityOfElementLocated(By.name(pageprops.getProperty("SIGNIN_BTN")))); pageDriver.findElement(By.name(pageprops.getProperty("SIGNIN_BTN"))).click(); Thread.sleep(15000); wait.until(ExpectedConditions .visibilityOfElementLocated(By.name(pageprops.getProperty("LOGIN_USERNAME")))); findElementByNameclear("UIATextField", "label", "User ID or email"); findElementByNameAndSendKeys("UIATextField", "label", "User ID or email", email); System.out.println("Before sendkeys for password"); findElementByNameAndSendKeys("UIASecureTextField", "label", "password", password); Thread.sleep(10000); JavascriptExecutor jse = (JavascriptExecutor) pageDriver; jse.executeScript("UIATarget.localTarget().frontMostApp().keyboard().buttons()['Go'].tap();"); Thread.sleep(20000); /* wait.until(ExpectedConditions.visibilityOfElementLocated(By .name(pageprops .getProperty("OK_BTN"))));*/ if (pageDriver.getPageSource().contains("OK")) { pageDriver.findElement(By.name("OK")).click(); } else { Thread.sleep(3000); } Thread.sleep(10000); } catch (Exception e) { MintLogger.log(Level.INFO, "Unable to login"); e.printStackTrace(); } }
From source file:com.qkn.automation.pages.LoginPage.java
public void loginIosApplitools(String email, String password) throws Exception { try {/*from w ww . j a v a 2 s . c o m*/ WebDriverWait wait = new WebDriverWait(pageDriver, 30); wait.until(ExpectedConditions.visibilityOfElementLocated(By.name(pageprops.getProperty("SIGNIN_BTN")))); eyes.checkWindow("IOS Welcome page"); pageDriver.findElement(By.name(pageprops.getProperty("SIGNIN_BTN"))).click(); Thread.sleep(20000); //applitools to test sign in page eyes.checkWindow("IOS Sign in page"); wait.until( ExpectedConditions.visibilityOfElementLocated(By.name(pageprops.getProperty("LOGIN_USERID")))); System.out.println("Before send keys for username"); findElementByNameAndSendKeys("UIATextField", "label", "User ID or email", email); System.out.println("Before sendkeys for password"); findElementByNameAndSendKeys("UIASecureTextField", "label", "password", password); Thread.sleep(10000); // wait.until(ExpectedConditions.elementToBeClickable(By.name(pageprops.getProperty("LOGIN_BTN")))); // pageDriver.findElement(By.xpath(pageprops.getProperty("LOGIN_BTN"))).click(); // pageDriver.findElement(By.className("UIAImage")).click(); JavascriptExecutor jse = (JavascriptExecutor) pageDriver; jse.executeScript("UIATarget.localTarget().frontMostApp().keyboard().buttons()['Go'].tap();"); //Thread.sleep(30000); wait.until(ExpectedConditions.visibilityOfElementLocated(By.name(pageprops.getProperty("OK_BTN")))); eyes.checkWindow("IOS Notification Popup"); Thread.sleep(5000); if (pageDriver.getPageSource().contains("OK")) { pageDriver.findElement(By.name("OK")).click(); } Thread.sleep(23000); } catch (Exception e) { MintLogger.log(Level.INFO, "Unable to login"); e.printStackTrace(); } }
From source file:com.qkn.automation.pages.LoginPage.java
public void loginViaGetStartedIos(String email, String password) throws Exception { try {// w w w . j ava2 s . co m WebDriverWait wait = new WebDriverWait(pageDriver, 120); pageDriver.findElement(By.name(pageprops.getProperty("GET_STARTED_BTN"))).click(); Thread.sleep(10000); Thread.sleep(10000); wait.until(ExpectedConditions.visibilityOfElementLocated(By.name(pageprops.getProperty("SIGNIN_BTN")))); pageDriver.findElement(By.name(pageprops.getProperty("SIGNIN_BTN"))).click(); Thread.sleep(20000); wait.until( ExpectedConditions.visibilityOfElementLocated(By.name(pageprops.getProperty("LOGIN_USERID")))); System.out.println("Before send keys for username"); findElementByNameAndSendKeys("UIATextField", "label", "User ID or email", email); System.out.println("Before sendkeys for password"); findElementByNameAndSendKeys("UIASecureTextField", "label", "password", password); Thread.sleep(10000); // wait.until(ExpectedConditions.elementToBeClickable(By.name(pageprops.getProperty("LOGIN_BTN")))); // pageDriver.findElement(By.xpath(pageprops.getProperty("LOGIN_BTN"))).click(); // pageDriver.findElement(By.className("UIAImage")).click(); JavascriptExecutor jse = (JavascriptExecutor) pageDriver; jse.executeScript("UIATarget.localTarget().frontMostApp().keyboard().buttons()['Go'].tap();"); Thread.sleep(20000); wait.until(ExpectedConditions.visibilityOfElementLocated(By.name(pageprops.getProperty("OK_BTN")))); if (pageDriver.getPageSource().contains("OK")) { pageDriver.findElement(By.name("OK")).click(); } Thread.sleep(13000); } catch (Exception e) { MintLogger.log(Level.INFO, "Unable to login via Get Started"); e.printStackTrace(); } }
From source file:com.qkn.automation.pages.LoginPage.java
public void loginWithInValidCredentials(String email, String password) throws Exception { QuickenLogger.log(Level.INFO, "loginWithInValidCredentials"); WebDriverWait wait = new WebDriverWait(pageDriver, 30); pageDriver.findElement(By.name(pageprops.getProperty("SINGUP_BUTTON_LOGINPAGE"))).click(); Thread.sleep(20000);//from w ww.j ava2s . c o m wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(pageprops.getProperty("LOGIN_USERNAME")))); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.CONTROL + "a"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.DELETE); System.out.println("Before send keys for username"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(email); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.CONTROL + "a"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.DELETE); // Thread.sleep(3000); System.out.println("Before sendkeys for password"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(password); Thread.sleep(5000); pageDriver.navigate().back(); pageDriver.findElement(By.xpath(pageprops.getProperty("SIGNIN_BTN"))).click(); }
From source file:com.qkn.automation.pages.LoginPage.java
public void WelocomeBackIos() throws Exception { WebDriverWait wait = new WebDriverWait(pageDriver, 30); pageDriver.findElement(By.name("Welcome")).click(); // Thread.sleep(5000); }
From source file:com.qkn.automation.pages.LoginPage.java
public void navigateToLearnMoreIos() throws Exception { WebDriverWait wait = new WebDriverWait(pageDriver, 120); pageDriver.findElement(By.name(pageprops.getProperty("GET_STARTED_BTN"))).click(); Thread.sleep(10000);//from ww w .j av a 2 s . c om eyes.checkWindow("GET_STARTED"); pageDriver.findElement(By.name(pageprops.getProperty("LEARN_MORE"))).click(); Thread.sleep(10000); eyes.checkWindow("LEARN_MORE"); Thread.sleep(15000); pageDriver.navigate().back(); Thread.sleep(10000); pageDriver.navigate().back(); Thread.sleep(10000); }
From source file:com.qkn.automation.pages.LoginPage.java
public void loginViaGetStarted(String email, String password) throws Exception { MintLogger.log(Level.INFO, "loginWithInValidCredentials"); WebDriverWait wait = new WebDriverWait(pageDriver, 30); pageDriver.findElement(By.name("Get started")).click(); Thread.sleep(4000);// ww w . java 2s . c o m /*JavascriptExecutor js = (JavascriptExecutor) pageDriver; HashMap flickObject = new HashMap(); flickObject.put("endX", 0); flickObject.put("endY", 0); flickObject.put("touchCount", 1); js.executeScript("mobile: swipe", flickObject); Thread.sleep(4000); */ pageDriver.findElement(By.name(pageprops.getProperty("SINGUP_BUTTON_GETSTARTEDPAGE"))).click(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(pageprops.getProperty("LOGIN_USERNAME")))); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.CONTROL + "a"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.DELETE); System.out.println("Before send keys for username"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(email); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.CONTROL + "a"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.DELETE); // Thread.sleep(3000); System.out.println("Before sendkeys for password"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(password); Thread.sleep(3000); pageDriver.navigate().back(); Thread.sleep(1000); pageDriver.findElement(By.xpath(pageprops.getProperty("SIGNIN_BTN"))).click(); /* JavascriptExecutor jse = (JavascriptExecutor) pageDriver; jse.executeScript("UIATarget.localTarget().frontMostApp().keyboard().buttons()['Go'].tap();"); */ Thread.sleep(15000); wait.until(ExpectedConditions.visibilityOfElementLocated(By.name(pageprops.getProperty("OK_BTN")))); if (pageDriver.getPageSource().contains("OK")) { pageDriver.findElement(By.name("OK")).click(); } Thread.sleep(13000); }
From source file:com.qkn.automation.pages.LoginPage.java
public void navigateBackToLoginPageFromLoginError() throws Exception { MintLogger.log(Level.INFO, "navigateBackToLoginPageFromLoginError"); WebDriverWait wait = new WebDriverWait(pageDriver, 120); //wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("OK"))); System.out.println("popup displayed"); String msg = pageDriver.findElement(By.id("android:id/message")).getText(); System.out.println(msg);//from w w w . ja va 2 s. c o m //android:id/alertTitle pageDriver.findElement(By.name("OK")).click(); //id=android:id/button1....android.widget.TextView Thread.sleep(3000); pageDriver.navigate().back(); Thread.sleep(5000); }
From source file:com.qkn.automation.pages.LoginPage.java
public void windatafile() throws Exception { MintLogger.log(Level.INFO, "Select the first windows data file"); pageDriver.findElement(By.name("Windows")).click(); }
From source file:com.qkn.automation.pages.LoginPage.java
public void macdatafile() throws Exception { MintLogger.log(Level.INFO, "Select the second mac data file"); pageDriver.findElement(By.name("Mac")).click(); }