0
   if(ScenarioName.equals("MoveinwithVantivCard")) {

     driver.findElement(By.id("btnsave")).click();
  // driver.switchTo().frame("paymentIFrame");
     driver.switchTo().frame(driver.findElement(By.id("paymentIFrame")));
     driver.findElement(By.id("cardNumber")).sendKeys("5499990123456781");
     driver.findElement(By.id("submit")).click();
    String paid=driver.findElement(By.id("//h3[@id='paidamount']")).getText();
    System.out.println(paid);

      }

Here I am trying to do Credit card Payment After that i am trying to fetch that paid amount value which is in frame but it is not happening it waits for long time any help would be appreciated

0

If the amount is appearing in an iframe, first you need to switch to that iframe by its id before you fetch the amount. Once you are done with the iframe, return to the main window.

// to switch to the iframe by iframe id
driver.switchTo().frame(driver.findElement(By.id("frameId")));
//get the paid amount here once done switch to main window as below.
driver.switchTo().defaultContent();

Hope this helps.

  • driver.switchTo().defaultContent(); when i debug it stops at that defaultcontent – John snow Nov 14 '18 at 10:41
  • reasons might be numerous, although try using driver.switchTo().parentFrame(); – Prasad_Joshi Nov 14 '18 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.