List of usage examples for org.openqa.selenium WebElement click
void click();
From source file:com.digi.selenium.util.PageNavigation.java
protected void paymentPostpaidBroadband() { try {/*from w w w.jav a 2 s . co m*/ JavascriptExecutor jse = (JavascriptExecutor) getDriver(); jse.executeScript("window.scrollBy(0,-500)", ""); //*[@id="planDetails"]/div[2]/div[1]/div[6]/button WebElement pay = getDriver() .findElement(By.xpath("//*[@id='planDetails']/div[2]/div[1]/div[6]/button")); pay.click(); waitForPageLoad(100); //*[@id="rp-form-field-payamount"] driver.findElement(By.id("rp-form-field-payamount")).clear(); handleInputField_ByID("rp-form-field-payamount", AppConstants.RMVALUE); JavascriptExecutor jse1 = (JavascriptExecutor) getDriver(); jse1.executeScript("window.scrollBy(0,500)", ""); //*[@id="proceed-button"]/span[1] WebElement payment = (new WebDriverWait(driver, 1000)) .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='proceed-button']/span[1]"))); payment.click(); waitForPageLoad(20); Thread.sleep(500); WebElement payment2 = (new WebDriverWait(driver, 1000)) .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='proceed-button']/span[1]"))); payment2.click(); waitForPageLoad(100); } catch (Exception e) { log.error("Fail : Failed to initialize Payment"); e.printStackTrace(); System.exit(0); } }
From source file:com.digi.selenium.util.PageNavigation.java
protected void cancelPaymentPageandReturn() { try {//from w w w . jav a 2 s .co m //Back to Accounts & Plans JavascriptExecutor jse1 = (JavascriptExecutor) getDriver(); jse1.executeScript("window.scrollBy(0,500)", ""); //*[@id="pay-getaway-foot"]/div[2]/button[3] WebElement cancel = (new WebDriverWait(driver, 1000)).until(ExpectedConditions .elementToBeClickable(By.xpath("//*[@id='pay-getaway-foot']/div[2]/button[3]"))); cancel.click(); Thread.sleep(500); getDriver().switchTo().alert().accept(); waitForPageLoad(100); } catch (Exception e) { log.error("Fail : Failed to initialize Payment"); e.printStackTrace(); System.exit(0); } }
From source file:com.digi.selenium.util.PageNavigation.java
protected void returnOnAccountsPage() { try {/* w w w .j a v a2 s . co m*/ WebElement back = (new WebDriverWait(driver, 1000)).until( ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='menu-section']/div/ul/li[5]/a"))); back.click(); } catch (Exception e) { log.error("Fail : Failed to initialize Payment"); e.printStackTrace(); System.exit(0); } }
From source file:com.digi.selenium.util.PageNavigation.java
protected void paymentPostpaid() { try {/*ww w .java2 s. c om*/ JavascriptExecutor jse = (JavascriptExecutor) getDriver(); jse.executeScript("window.scrollBy(0,-500)", ""); //*[@id="planDetails"]/div[2]/div[1]/div[6]/button WebElement pay = getDriver() .findElement(By.xpath("//*[@id='planDetails']/div[2]/div[1]/div[6]/button")); pay.click(); waitForPageLoad(100); //*[@id="rp-form-field-payamount"] driver.findElement(By.id("rp-form-field-payamount")).clear(); handleInputField_ByID("rp-form-field-payamount", AppConstants.RMVALUE); JavascriptExecutor jse1 = (JavascriptExecutor) getDriver(); jse1.executeScript("window.scrollBy(0,500)", ""); //*[@id="proceed-button"]/span[1] WebElement payment = (new WebDriverWait(driver, 1000)) .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='proceed-button']/span[1]"))); payment.click(); waitForPageLoad(20); Thread.sleep(500); WebElement payment2 = (new WebDriverWait(driver, 1000)) .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='proceed-button']/span[1]"))); payment2.click(); Thread.sleep(1000); waitForPageLoad(100); } catch (Exception e) { log.error("Fail : Failed to initialize Payment"); e.printStackTrace(); System.exit(0); } }
From source file:com.digi.selenium.util.PageNavigation.java
protected void cancelPaymentAndReturn() { try {//from w w w. j a v a2 s. c o m //Back to Accounts & Plans JavascriptExecutor jse1 = (JavascriptExecutor) getDriver(); jse1.executeScript("window.scrollBy(0,500)", ""); //*[@id="pay-getaway-foot"]/div[2]/button[3] WebElement cancel = (new WebDriverWait(driver, 1000)).until(ExpectedConditions .elementToBeClickable(By.xpath("//*[@id='pay-getaway-foot']/div[2]/button[3]"))); cancel.click(); Thread.sleep(500); getDriver().switchTo().alert().accept(); waitForPageLoad(100); } catch (Exception e) { log.error("Fail : Failed to initialize Payment"); e.printStackTrace(); System.exit(0); } }
From source file:com.digi.selenium.util.PageNavigation.java
protected void returnAccountsPage() { try {/* w w w.j a v a 2 s . c om*/ WebElement back = (new WebDriverWait(driver, 1000)).until( ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='menu-section']/div/ul/li[5]/a"))); back.click(); } catch (Exception e) { log.error("Fail : Failed to initialize Payment"); e.printStackTrace(); System.exit(0); } }
From source file:com.digi.selenium.util.PageNavigation.java
protected void reloadPrepaid_Broadband() { try {//from ww w . j a va 2 s .com JavascriptExecutor js = (JavascriptExecutor) getDriver(); js.executeScript("window.scrollBy(0,-500)", ""); WebElement reload = null; //*[@id="planDetails"]/div[2]/div[1]/div[4]/a //*[@id='planDetails']/div[3]/div[1]/div[4]/a // Test radio button of amount 10 reload = getDriver().findElement(By.xpath("//*[@id='planDetails']/div[2]/div[1]/div[4]/a")); reload.click(); waitForPageLoad(100); clickOnRadio10(); waitForPageLoad(100); // Test radio button of amount 30 reload = getDriver().findElement(By.xpath("//*[@id='planDetails']/div[2]/div[1]/div[4]/a")); reload.click(); waitForPageLoad(100); clickOnRadio30(); waitForPageLoad(100); // Test radio button of amount 50 reload = getDriver().findElement(By.xpath("//*[@id='planDetails']/div[2]/div[1]/div[4]/a")); reload.click(); waitForPageLoad(100); clickOnRadio50(); waitForPageLoad(100); // Test radio button of amount 100 reload = getDriver().findElement(By.xpath("//*[@id='planDetails']/div[2]/div[1]/div[4]/a")); reload.click(); waitForPageLoad(100); clickOnRadio100(); waitForPageLoad(100); } catch (Exception e) { log.error("Fail : Failed to initialize Payment"); System.out.println(e); e.printStackTrace(); //e.printStackTrace(); System.exit(0); } }
From source file:com.digi.selenium.util.PageNavigation.java
protected void clickOnRadio10() { try {/* w w w . j a va 2 s . com*/ // Put email id on text field as it can not be blank //*[@id="reloadForm__email"] WebElement emailtxt = getDriver().findElement(By.id("reloadForm__email")); System.out.println(emailtxt.isEnabled()); if (emailtxt.isEnabled()) { handleInputField_ByID("reloadForm__email", AppConstants.EMAIL); Thread.sleep(500); } JavascriptExecutor js1 = (JavascriptExecutor) getDriver(); js1.executeScript("window.scrollBy(0,400)", ""); //*[@id="prepaidReloadForm"]/ul/li[2]/label/div WebElement radio = getDriver().findElement(By.xpath("//*[@id='prepaidReloadForm']/ul/li[2]/label/div")); radio.click(); // now select check box to accept license agreement WebElement checkbox = getDriver().findElement(By.xpath("//*[@id='prepaidReloadForm']/label/div")); checkbox.click(); // click on proceed button after selecting radio button and check box // WebElement elementproceed=getDriver().findElement(By.xpath("//*[@id='proceedBtn']")); //*[@id="proceedBtn"] WebElement proceed = (new WebDriverWait(driver, 1000)) .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='proceedBtn']"))); proceed.click(); waitForPageLoad(100); Thread.sleep(500); JavascriptExecutor js = (JavascriptExecutor) getDriver(); js.executeScript("window.scrollBy(0,500)", ""); } catch (Exception e) { System.out.println(e); e.printStackTrace(); log.error("Fail : Failed to Reload amount."); System.exit(0); } }
From source file:com.digi.selenium.util.PageNavigation.java
protected void clickOnRadio30() { try {// w w w. ja v a 2s .c o m WebElement emailtxt = getDriver().findElement(By.id("reloadForm__email")); if (emailtxt.isDisplayed()) { handleInputField_ByID("reloadForm__email", AppConstants.EMAIL); Thread.sleep(500); } JavascriptExecutor js1 = (JavascriptExecutor) getDriver(); js1.executeScript("window.scrollBy(0,400)", ""); WebElement radio = getDriver().findElement(By.xpath("//*[@id='prepaidReloadForm']/ul/li[3]/label/div")); radio.click(); // now select check box to accept license agreement WebElement checkbox = getDriver().findElement(By.xpath("//*[@id='prepaidReloadForm']/label/div")); checkbox.click(); // click on proceed button after selecting radio button and check box // WebElement elementproceed=getDriver().findElement(By.xpath("//*[@id='proceedBtn']")); //*[@id="proceedBtn"] WebElement proceed = (new WebDriverWait(driver, 1000)) .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='proceedBtn']"))); proceed.click(); waitForPageLoad(100); Thread.sleep(500); JavascriptExecutor js = (JavascriptExecutor) getDriver(); js.executeScript("window.scrollBy(0,500)", ""); } catch (Exception e) { System.out.println(e); e.printStackTrace(); log.error("Fail : Failed to Reload amount."); System.exit(0); } }
From source file:com.digi.selenium.util.PageNavigation.java
protected void clickOnRadio50() { try {// ww w. j a v a2 s.c o m WebElement emailtxt = getDriver().findElement(By.id("reloadForm__email")); if (emailtxt.isDisplayed()) { handleInputField_ByID("reloadForm__email", AppConstants.EMAIL); Thread.sleep(500); } JavascriptExecutor js1 = (JavascriptExecutor) getDriver(); js1.executeScript("window.scrollBy(0,400)", ""); WebElement radio = getDriver().findElement(By.xpath("//*[@id='prepaidReloadForm']/ul/li[4]/label/div")); radio.click(); // now select check box to accept license agreement WebElement checkbox = getDriver().findElement(By.xpath("//*[@id='prepaidReloadForm']/label/div")); checkbox.click(); // click on proceed button after selecting radio button and check box // WebElement elementproceed=getDriver().findElement(By.xpath("//*[@id='proceedBtn']")); //*[@id="proceedBtn"] WebElement proceed = (new WebDriverWait(driver, 1000)) .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='proceedBtn']"))); proceed.click(); waitForPageLoad(100); Thread.sleep(500); JavascriptExecutor js = (JavascriptExecutor) getDriver(); js.executeScript("window.scrollBy(0,500)", ""); } catch (Exception e) { System.out.println(e); e.printStackTrace(); log.error("Fail : Failed to Reload amount."); System.exit(0); } }