• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Selenium: Getting error in payment page

Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm working on an automation suite for payment page, after entering Credit card number, Image attached
we have 2 buttons which should enable
1- Check credit card
2- CVV

But after entering Credit card number, it is not enabling. Please help,
PSB code.

package page.object.classes;

import static org.testng.Assert.assertTrue;

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.testng.Assert;

import commons.WaitTypes;
public class PaymentInfoPage {
               WebDriver driver;
               @FindBy(xpath=".//h1[contains(.,'Payment Information')]")
               WebElement paymentInfoText;
               WebElement cardHolderName;
               WebElement cardNumber;
               WebElement btnValidateCardNumber;
               WebElement cvv;
               WebElement monthDropDown;
               WebElement monthDropDownSelection;
               WebElement yearDropDown;
               WebElement yearDropDownSelection;

               WebElement termsCheckBox;

               WebElement dummyClick;

               WebElement btnValidatePayment;
               public PaymentInfoPage(WebDriver driver){
                               this.driver = driver;
                                               PageFactory.initElements(driver, this);
               }// End of Class Constructor

               public void paymentProcessing(String ccName, String ccNumber, String cvvNumber)  {
                               WaitTypes.getWhenVisible(driver, cardHolderName, 40).clear();
                               WaitTypes.getWhenVisible(driver, cardNumber, 10).clear();
                               //JavascriptExecutor jse = (JavascriptExecutor) driver;
                               //new Actions(driver).moveToElement(driver.findElement(By.id("card-Number"))).click().sendKeys("Test").build().perform();

                               WaitTypes.getWhenVisible(driver, btnValidateCardNumber, 50).click();
                               //WaitTypes.waitUntilJQuery(driver, 10);            
                               WaitTypes.getWhenVisible(driver, cvv, 50).sendKeys(cvvNumber);
                               WaitTypes.clickWhenVisible(driver, monthDropDown, 20);
                               // WaitTypes.clickWhenVisible(driver, monthDropDown, 40);
                               // WaitTypes.clickWhenVisible(driver, monthDropDownSelection, 10);
                               WaitTypes.clickWhenVisible(driver, yearDropDown, 10);
                               WaitTypes.clickWhenVisible(driver, yearDropDownSelection, 10);
                               WaitTypes.clickWhenVisible(driver, termsCheckBox, 10);
                               // btnValidatePayment.click();
                               JavascriptExecutor js = (JavascriptExecutor) driver;
                               js.executeScript("window.scrollBy(0,250)", "");
                               /*WaitTypes.clickWhenVisible(driver, btnValidatePayment, 250);*/
                               try {
                               } catch (InterruptedException e) {
                                               // TODO Auto-generated catch block
                               WaitTypes.clickWhenVisible(driver, btnValidatePayment, 10);
                               //js.executeScript("arguments[0].click();", btnValidatePayment);
               public boolean verifyPage(){
                               try {
                                     assertTrue(WaitTypes.getWhenVisible(driver, paymentInfoText, 55).getText().contains("Payment Information"));
                                     return true;
                                   } catch (Exception e) {
                                               return false;
               }//End of
[/i]VerifyPage method

[Thumbnail for pp.png]
payment page issue
Ranch Hand
Posts: 460
Netbeans IDE Oracle Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You must know how is working your testing application.

Probably, your input isn't valid and therefore your button is not active.

You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic