Numeric values field validation


I’m filling out forms with data imported with csvread. I can fill in all fields. But when I save the forms some fields aren’t saved.

The fields have javascript validation:

onkeypress=“return (event.charCode == 8 || event.charCode == 0 || event.charCode == 13) ? null : event.charCode >= 48 && event.charCode <= 57”

I’m guessing the numbers are imported as characters and that might be why they don’t pass the verification.

How can I make sure the fields with validation are also saved?

Thank you

My guess is that the normal CLICK and TYPE do not trigger the Javascript validation script at all, and thus the error message upon saving.

Solution: Replace your TYPE or SENDKEYS command by XTYPE. fills out the form correctly. All fields are correctly filled in before hits the save button.

The forms works, I can do it manually.

When I stop before saving, delete the input and replace it by typing it myself, then the values are saved correctly.

Yes, exactly this is a sign that you need XTYPE to simulate real keyboard input.

Selenium IDE TYPE fills the form, but does this “via HTML” so to speak. This is different from simulating real keystrokes. In both cases the input gets filled, but only with XType does the website think a real user is filling out the form.

How do I use a csvread variable (ex. ${COL1}) in Xtype?

I already considered trying XType, but I have no idea how to make it use the variables from csvread. I can’t find the paragraph on that topic in the manuals…

thank you

Variables in XType work like Type. Just use

  • Type | LOCATOR | ${COL1}
  • XType | ${COL1}

Does that work? If not, a screencast would be helpful to see what is going on.

Hi Plankton,

I have found the solution. I wrote the variable in value instead of in target. That solved it! Thank for the help!