2

I am trying to enter the stripe card details . It does not enter card number. I am able to click but sendkeys or javascript executor and action class throw no such window exception. But I am able to enter date and CVC..This card detail is a frame. I am already switching to frame before entering the detail.

enter image description here enter image description here

public void enterCardDetails() throws InterruptedException {
          
       cardNumberStripe.click();
       cardNumberStripe.clear();
       cardNumberStripe.sendKeys("4242424242424242");
    
        dateStripe.sendKeys("08/23");
        Thread.sleep(2000);
        cardVerificationNumberStripe.sendKeys("123");
        Thread.sleep(2000);
        zipCodeStripe.sendKeys("1000");
   }

JsExecutor code that I tried

JavascriptExecutor user=  (JavascriptExecutor)driver;
user.executeScript("arguments[0].value='4242424242424242'",cardNumberStripe);

chromedriverVersion: 83.0.4103.39 ( chrome=84.0.4147.135)
java.version: '1.8.0_261'

  • How do you get the card number element? Maybe you have the wrong element. For example in your screenshot you show the placeholder label selected instead of the textbox. – CherryDT Sep 06 '20 at 07:56
  • Can you show us the selector for **dateStripe** and **cardVerificationNumberStripe**. – Dilip Meghwal Sep 06 '20 at 09:34
  • @DilipMeghwal ... Below are the Selectors @FindBy(how=How.XPATH,using="//input[@placeholder='Card number']") WebElement cardNumberStripe; @FindBy(how=How.XPATH,using="//input[@placeholder='MM / YY']") WebElement dateStripe; @FindBy(how=How.XPATH,using="//input[@placeholder='CVC']") WebElement cardVerificationNumberStripe; – Kanika Hans Sep 06 '20 at 10:46
  • 1
    All locators are correct, can you update the question with exact error logs. – Dilip Meghwal Sep 06 '20 at 11:08
  • Things look good, even the JSExecutor should work fine.. looks like some issue with location the element, Exact error will be appreciated. – Kumar Rishabh Sep 06 '20 at 14:44
  • @all...Now I am able to enter card number.. I just put code like cardNumberStripe.Sendkeys("4242 4242 4242 4242"); cardNumberStripe.clear(); cardNumberStripe.Sendkeys("4242 4242 4242 4242"); – Kanika Hans Sep 08 '20 at 01:07

0 Answers0