setText is inputting a mixed up string in Stripe iframe

Hello,

I have code that looks like this:

WebUI.setText(findTestObject(‘Page_BuySubscrip/input_cardnumber’), ‘4242424242424242’)

However, when Katalon plays it back, it looks like:

Any ideas on why it’s putting in the mixed up number?

mixed up card number.png

we need more information, otherwise it will be guessing game of epic proportions.

Hi there. You can get to the page from here:

https://articulate.com/order/sign_up?education=false&team=true

You’ll have to create an ID. After that, click on Add Payment Method. Then, the Card Number field appears.

Here’s my script in Katalon:

WebUI.switchToFrame(findTestObject(‘Page_Buy an Articulate 360 Subscrip/iframe___privateStripeFrame4’), 0)

WebUI.setText(findTestObject(‘Page_Buy an Articulate 360 Subscrip/input_cardnumber’), GlobalVariable.cardNumber)

Let me know what other information you need.

1 Like

wow … what an interesting problem
so basically, script is typing too fast while events are trying to format text you are putting in…
some small delay between keystrokes will probably help a lot.

Andrej Podhajský said:

wow … what an interesting problem
so basically, script is typing too fast while events are trying to format text you are putting in…
some small delay between keystrokes will probably help a lot.

The solution that I landed on ended up being pretty simple: Add a bunch of spaces to the card number like this:

4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2

Since Stripe is automatically removing the formatting, this essentially slows down the input. Thanks for the idea Andrej.

1 Like

Brian Batt said:

Andrej Podhajský said:

wow … what an interesting problem
so basically, script is typing too fast while events are trying to format text you are putting in…
some small delay between keystrokes will probably help a lot.

The solution that I landed on ended up being pretty simple: Add a bunch of spaces to the card number like this:

4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2

Since Stripe is automatically removing the formatting, this essentially slows down the input. Thanks for the idea Andrej.

Hi Brain, We also did the same solution and also we tried “4aaaaaa2aaaaaa4aaaaaa2aaaaaa4aaaaaa2aaaaaa4aaaaaa2aaaaaa4aaaaaa2aaaaaa4aaaaaa2aaaaaa4aaaaaa2aaaaaa4aaaaaa2”. both worked some few runs, then again nos got mixing.
E.g. My Script trying to register 500 users + add new card and it run for 10 users successfully then it failed for wrong numbers entered.

Let me know if there any possible solution to fix this.
Thanks

Hi saminathan,

For the card number, I used spaces instead of letters. I used about 10 spaces between each for my site.

I would recommend to just keep adding numbers or spaces until you get more consistent results.

This is just advice. You are free to ignore it if you wish.

I understand why you guys want to use the solution you came up with, but it is really not what a user would do and therefore should not be a preferred solution for automation.

I agree with Andrej, the API is typing into the field too quickly – certainly more quickly than the JavaScript formatting/validation code can handle it.

(1) Therefore, you should write your own API that wraps setText (or even sendKeys) in a loop and provides a suitable delay between character updates to the field. You could even verify the additions as the loop progresses.

(2) Alternatively, you write a piece of JavaScript code that updates the field in one shot. This doesn’t mimic a user typing though and you may need to trigger the onchange event yourself so that the validation code kicks in.

#1 and #2 guys, are better engineered solutions than using the control and its validation code for purposes they were never intended. If at some point that background code changes its behavior, your “solution” may suddenly be a problem you may find difficult to pin down.

Like I said, this is just advice. You are free to ignore it if you wish.