Having issue with Payment Form

Hi,

Need help in completing a payment form. I used the “Web Recorder” and it shows below.

Below is the field and element.

I tried several things in manual scripts and still not able to fix it. Tried Delay/Wait, Clicking the Element first which is a PASS, but when it comes to SendKeys and Set Text in the card details, it’s an error.

Thanks in advance.

2 Likes

Are you sure you are encrypting your password first and then keeping it in your step 68 ?

hello Monty, I believe I am please see below if it’s what you are expecting,

1 Like

@atantong you can try to use Set Text instead of Set Encrypted Text.
have you try it?

1 Like

yup already tried but just for reference here it is

1 Like

seems there’s something wrong with your selector @atantong

this is your selector, right? //*[contains(@id, "adyen-checkout-encryptedCardNumber")])[1]

but the actual ID contains random number (as you can see on the image)
image

I think you can use another alternative for the selector value

1 Like

Yes, it does show that you only used the Recorder–click, click, click. Instead of inserting WebUI.delay(2), instead you could have:

WebUI.click(findTestObject('payByCardBtn'))
WebUI.waitForPageLoad(10)

WebUI.waitForElementVisible(findTestObject('creditCardNumberField'), 10)

" and let's make sure there is no problem with the object"
WebUI.verifyElementClickable(findTestObject('creditCardNumberField'))
WebUI.click(findTestObject('creditCardNumberField'))
WebUI.setEncryptedText(findTestObject('creditCardNumberField'), "...")

All those “verify” statements and “wait” statements aren’t inserted by the Recorder. Those you have to insert after the fact. And, personally, I think you should add them permanently. Your test case will flow more in line with your web page when you do and they may give you more feedback on possible issues when a statement does not work.

Edit: and what if you changed the starting asterisk to <input> so you don’t have to use the array format:
//input[contains(@id,"adyen-checkout-encryptedCardNumber-")]

yup, thats why i have not included the random number at the end because it’s dynamic. The xpath i used is accurate and is selected as seen on the previous screenshots.

1 Like

Hello,

I have tried above, below is the error.

1 Like

Can u try to use the below xpath and then check

(//input[contains(@id, ‘adyen-checkout-encryptedCardNumber’)])[1]

yup, already tried this one, I have attached screenshot above. Below is a clear screenshot

1 Like

with encrypted text , right ?

The above is what you have as your pathway to the “Credit Card Number”. What I am suggesting is instead, to use:
//input[contains(@id, 'adyen-checkout-encryptedCardNumber')]

When you change from using the asterisk to the actual tag, you do not need the “array” format. You needed the array format with the asterisk because your tag could have been either <span> or <input>. Without the asterisk, the <span> is removed and you have only 1 of 1. Now, this probably does not fix your security issue, but is personally, useful information.

When you enter text manually into the field, do you have to enter the text as 4 groups of 4 characters, or can you enter the text as 16 characters and then the text gets formatted?

1 Like

I tried without the array format and its the same thing where it recognizes the element but fails when typing in the credit card number.
When entering the text manually, I enter the 16 digit numbers continuosly but it automatically groups it into 4 and a space between each every after the 4th digit of each group. Sample below.

Here are the elements for the credit card field for your reference. It starts in the blue arrow. Im using the yellow highlights, I also tried other locators starting from blue and its still an error.

Could you please tell us if the earlier issue was resolved ? It seems that the latest one is a different question

Edited the locator and still not fixed.

I noticed that the target HTML contains an <iframe> element.

Unfortunately, the “Web Recorder” tool does not generate a test script that works good to HTML with <iframe>. The tool is not perfect. You should be prepared to edit the scripts generated by the tool to make them better.

@atantong

Your test script must have a statement of “Switch To Frame”.

Did you insert a statement of WebUI.switchToFrame? I guess you didn’t. I suppose that this is the reason why the xpath generated by Web Recorder failed to find the element at //input[contains(@id, 'adyen-checkout-encryptedCardNumber')].


Whether to use setText or setEncriptedText ? — it would be a side issue after the iframe.

1 Like

After switch to frame and then set text, or set encrypted text, then to continue your test script, you should:

Hello, I was on leave and just got back at work today. Tried switch to frame and i get this error.

for script view tab