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.
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.
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?
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.
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.
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.