Required field showing a validation error

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
ag5264
Posts: 7
Joined: Sat Jul 16, 2016 10:03 am

Required field showing a validation error

Post by ag5264 » Wed May 15, 2019 5:28 am

VERSION BUILD=8970419 RECORDER=FX

mac0S Mojave Version 10.14.3

Firefox 56.0.2 (64-bit) (I'm on an old version to continue supporting image uploads)

Hi,

I'd appreciate if someone could provide some help with a script. I'm encountering an issue with a particular input field and have tried to get round it using multiple different recording methods and script changes.

Here is a screen recording of the script in progress. The particular field that is an issue is the 'Price' field, which is required: http://recordit.co/LFQq4gg1a7

The 'Title' field is also required however I managed to overcome an issue there by using the EVENTS command. Regardless of how I input the data into the 'Price' field, I can't get it to accept that data has been added and not flag the required error as if nothing has been entered. If I manually type a value after the script has finished, it accepts this of course. The data type for that field is a number so it's as if it's recognising the input as text and not validating it.

Unfortunately I can't provide access to the system to test anything as it's behind a login. Here's the current script:

Code: Select all

' Enter product data
SET !DATASOURCE sheet1.csv
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
SET !EXTRACT_TEST_POPUP NO
WAIT SECONDS=1
SET !TIMEOUT_STEP 2
SET !ERRORIGNORE YES
URL GOTO=https://vms-ui-staging.herokuapp.com/manager/orders
TAG POS=1 TYPE=IMG ATTR=SRC:https://vms-ui-staging.herokuapp.com/assets/icons/menu.svg
TAG POS=1 TYPE=BUTTON ATTR=TXT:Add<SP>product
WAIT SECONDS=2
CLICK X=996 Y=251
WAIT SECONDS=2
EVENTS TYPE=KEYPRESS SELECTOR="#control-2" CHARS={{!COL1}}
EVENTS TYPE=KEYPRESS SELECTOR="#control-3" CHARS={{!COL2}}
TAG POS=1 TYPE=EQ-FORM-BTN-RADIO ATTR=TXT:Live
WAIT SECONDS=2
TAG POS=1 TYPE=INPUT:NUMBER FORM=ACTION:https://vms-ui-staging.herokuapp.com/manager/catalogue/(modal:vendor/9a2c56c3-6ee0-4248-a9a9-3d8d9a52a96b/product/plain/create) ATTR=ID:control-5 CONTENT={{!COL3}}
WAIT SECONDS=2
EVENT TYPE=MOUSEDOWN SELECTOR="#control-6>DIV>DIV>DIV:nth-of-type(2)>INPUT" BUTTON=0
WAIT SECONDS=1
CLICK X=994 Y=564
EVENT TYPE=CLICK SELECTOR="#control-8>DIV>DIV>DIV:nth-of-type(2)>INPUT" BUTTON=0
WAIT SECONDS=1
CLICK X=808 Y=647
'TAG POS=1 TYPE=BUTTON FORM=ACTION:https://vms-ui-staging.herokuapp.com/manager/catalogue/(modal:vendor/9a2c56c3-6ee0-4248-a9a9-3d8d9a52a96b/product/plain/create) ATTR=TXT:Save
I've tried positional clicking and all sorts of things and can't get around this. Has anyone got any recommendations? I understand it may be difficult without access to troubleshoot but if I can provide further information let me know.

Thanks
Andy
chivracq
Posts: 8313
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Required field showing a validation error

Post by chivracq » Wed May 15, 2019 4:43 pm

ag5264 wrote:
Wed May 15, 2019 5:28 am
VERSION BUILD=8970419 RECORDER=FX

mac0S Mojave Version 10.14.3

Firefox 56.0.2 (64-bit) (I'm on an old version to continue supporting image uploads)

Hi,

I'd appreciate if someone could provide some help with a script. I'm encountering an issue with a particular input field and have tried to get round it using multiple different recording methods and script changes.

Here is a screen recording of the script in progress. The particular field that is an issue is the 'Price' field, which is required: http://recordit.co/LFQq4gg1a7

The 'Title' field is also required however I managed to overcome an issue there by using the EVENTS command. Regardless of how I input the data into the 'Price' field, I can't get it to accept that data has been added and not flag the required error as if nothing has been entered. If I manually type a value after the script has finished, it accepts this of course. The data type for that field is a number so it's as if it's recognising the input as text and not validating it.

Unfortunately I can't provide access to the system to test anything as it's behind a login. Here's the current script:

Code: Select all

' Enter product data
SET !DATASOURCE sheet1.csv
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
SET !EXTRACT_TEST_POPUP NO
WAIT SECONDS=1
SET !TIMEOUT_STEP 2
SET !ERRORIGNORE YES
URL GOTO=https://vms-ui-staging.herokuapp.com/manager/orders
TAG POS=1 TYPE=IMG ATTR=SRC:https://vms-ui-staging.herokuapp.com/assets/icons/menu.svg
TAG POS=1 TYPE=BUTTON ATTR=TXT:Add<SP>product
WAIT SECONDS=2
CLICK X=996 Y=251
WAIT SECONDS=2
EVENTS TYPE=KEYPRESS SELECTOR="#control-2" CHARS={{!COL1}}
EVENTS TYPE=KEYPRESS SELECTOR="#control-3" CHARS={{!COL2}}
TAG POS=1 TYPE=EQ-FORM-BTN-RADIO ATTR=TXT:Live
WAIT SECONDS=2
TAG POS=1 TYPE=INPUT:NUMBER FORM=ACTION:https://vms-ui-staging.herokuapp.com/manager/catalogue/(modal:vendor/9a2c56c3-6ee0-4248-a9a9-3d8d9a52a96b/product/plain/create) ATTR=ID:control-5 CONTENT={{!COL3}}
WAIT SECONDS=2
EVENT TYPE=MOUSEDOWN SELECTOR="#control-6>DIV>DIV>DIV:nth-of-type(2)>INPUT" BUTTON=0
WAIT SECONDS=1
CLICK X=994 Y=564
EVENT TYPE=CLICK SELECTOR="#control-8>DIV>DIV>DIV:nth-of-type(2)>INPUT" BUTTON=0
WAIT SECONDS=1
CLICK X=808 Y=647
'TAG POS=1 TYPE=BUTTON FORM=ACTION:https://vms-ui-staging.herokuapp.com/manager/catalogue/(modal:vendor/9a2c56c3-6ee0-4248-a9a9-3d8d9a52a96b/product/plain/create) ATTR=TXT:Save
I've tried positional clicking and all sorts of things and can't get around this. Has anyone got any recommendations? I understand it may be difficult without access to troubleshoot but if I can provide further information let me know.

Thanks
Andy
Ah-oooops...! I was going to help you and answer your Thread, but I realize you never followed up on your previous Thread, from 3 years ago, which is a "Show-Killer" for me to help Users (again), too bad...! :shock:

You'll first need to follow up on your previous Thread, and finish it "correctly" and useful for other Users for me to want to help you again, sorry..., and then you can maybe bump this one in 3 years if you still need a Solution by that time...? :wink:

But OK..., I don't want to be "too bitchy"..., for this one, the "Solution" if any, will indeed be with the 'EVENT' Mode... :idea:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
ag5264
Posts: 7
Joined: Sat Jul 16, 2016 10:03 am

Re: Required field showing a validation error

Post by ag5264 » Thu May 16, 2019 2:51 am

Thanks for your follow up. I actually didn't even realise that thread existed, Jason was an old colleague that posted through a shared account. Anyway, having looked at it, it appears that it was hijacked by another person anyway. We've got a shared macros accounts so I believe I've established the solution and will post that back into the other thread now.
chivracq
Posts: 8313
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Required field showing a validation error

Post by chivracq » Thu May 16, 2019 3:02 am

ag5264 wrote:
Thu May 16, 2019 2:51 am
Thanks for your follow up. I actually didn't even realise that thread existed, Jason was an old colleague that posted through a shared account. Anyway, having looked at it, it appears that it was hijacked by another person anyway. We've got a shared macros accounts so I believe I've established the solution and will post that back into the other thread now.
Han-hum...!, I didn't pay attention to the "Jason" <> "Andy" indeed..., only to "same Account" + didn't follow up on previous Thread, hum..., OK then..., yep, if you can follow up on that previous Thread and share the Sol...
And maybe an "Idea" to mention in your Profile that this Account is shared, even if, hum..., I'll "expect" the same "minimal Quality" from all People using it... No Pb btw to have separate Accounts for different Colleagues within a same Company... (Hum, unless all 3 Colleagues all go opening their parallel (duplicate) Thread about the same Qt...) :idea:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
Posts: 8313
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Required field showing a validation error

Post by chivracq » Thu May 16, 2019 4:01 am

OK, previous Thread updated with final Script/Sol, good...! :D

Nothing wrong with FF56 btw if you want to keep using v8.9.7, "recommended" Version is actually FF v55.0.3.
And v10.0.2 for FF will indeed have very little Use for you if you are on MacOS as there is no FIO Module for Local File-Access on MacOS (or Linux), and the 'Free' Version is pretty limited... (And the 'EVENT' Mode is also not implemented either in v10.0.2.)

So OK, I had watched your Video earlier, and this Line is causing the Pb if I'm correct:

Code: Select all

TAG POS=1 TYPE=INPUT:NUMBER FORM=ACTION:https://vms-ui-staging.herokuapp.com/manager/catalogue/(modal:vendor/9a2c56c3-6ee0-4248-a9a9-3d8d9a52a96b/product/plain/create) ATTR=ID:control-5 CONTENT={{!COL3}}
The Price is still being filled, but the 'Required' Validation doesn't go away...

Then OK, hum, I can't do any Testing by myself, but I think it should work using the 'EVENT' Mode..., either directly by filling in that Field from the 'EVENT' Mode..., which you've already tried I understand...

Then hum..., fill it in with the 'TAG' or the 'EVENT' Mode + add a 'CLICK' in it ('EVENT' Mode) + add an 'ENTER' (OK, everything is 'EVENT' Mode) + tab away with a Keyboard 'TAB' + 'CLICK' (will be recorded but can be dismissed) & Keyboard 'End' and/or 'Arrow Left/Right'. (All '+' are maybe not necessary, you need to try them one by one, until "stg" works...)
Or even try a fake mini-'MOUSEMOVE' maybe combined with the same Keyboard Actions I've already mentioned..., but a 'MOUSEMOVE' can be "dangerous" as it uses 'X/Y' Coordinates which can change depending on Screen Resolution and Browser Size and even the Width of the iMacros Side-Panel, and there is a Bug on 'MOUSEMOVE' if the Element doesn't get found, then the Script simply hang at the next Line, even with '!ERRORIGNORE'... (But I have a Workaround...)

And then, pfff..., if nothing works and you don't come out by yourself..., I would need to be able to "play" with the Page myself, maybe you can upload some 'HTML Saveas' (zipped) to your Thread if the JS Validation is hopefully already within the Page itself...
If you don't want to upload the Page "publicly" to the Forum, you can make it available "somewhere" and "fake report" any Post in this Thread where you can then post the URL (or Login&Password to that Site), and I'm the only one who can see your Report. (+ Forum Admin = TechSup)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
ag5264
Posts: 7
Joined: Sat Jul 16, 2016 10:03 am

Re: Required field showing a validation error

Post by ag5264 » Fri May 17, 2019 6:37 am

Thanks for the suggestions. I'll give it a crack and come back with my results.
chivracq
Posts: 8313
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Required field showing a validation error

Post by chivracq » Fri May 17, 2019 2:43 pm

ag5264 wrote:
Fri May 17, 2019 6:37 am
Thanks for the suggestions. I'll give it a crack and come back with my results.
OK..., have faith in the 'EVENT' Mode, ah-ah...! :twisted:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
ag5264
Posts: 7
Joined: Sat Jul 16, 2016 10:03 am

Re: Required field showing a validation error

Post by ag5264 » Mon May 20, 2019 6:38 am

OK, success!

Thanks for your suggestions, it's sometimes the obvious/easy things that are the least obvious.

So a number of things didn't work but I managed to get around it using arrow UP + DOWN to increase then revert the price to normal. Added with the TAG command to first enter the data, click the element again using the EVENT type and then keypress up and down:

Code: Select all

TAG POS=1 TYPE=INPUT:NUMBER FORM=ACTION:https://vms-ui-staging.herokuapp.com/manager/catalogue/(modal:vendor/9a2c56c3-6ee0-4248-a9a9-3d8d9a52a96b/product/plain/create) ATTR=ID:control-5 CONTENT={{!COL3}}
EVENT TYPE=CLICK SELECTOR="#control-5" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#control-5" KEYS="[38,40]""
Thanks for the help.
chivracq
Posts: 8313
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Required field showing a validation error

Post by chivracq » Mon May 20, 2019 3:04 pm

ag5264 wrote:
Mon May 20, 2019 6:38 am
OK, success!

Thanks for your suggestions, it's sometimes the obvious/easy things that are the least obvious.

So a number of things didn't work but I managed to get around it using arrow UP + DOWN to increase then revert the price to normal. Added with the TAG command to first enter the data, click the element again using the EVENT type and then keypress up and down:

Code: Select all

TAG POS=1 TYPE=INPUT:NUMBER FORM=ACTION:https://vms-ui-staging.herokuapp.com/manager/catalogue/(modal:vendor/9a2c56c3-6ee0-4248-a9a9-3d8d9a52a96b/product/plain/create) ATTR=ID:control-5 CONTENT={{!COL3}}
EVENT TYPE=CLICK SELECTOR="#control-5" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#control-5" KEYS="[38,40]""
Thanks for the help.
Alright, good to hear...! :D
"Have faith in the 'EVENT' Mode", I had said, ah-ah...! :wink:

Hum, and your Script can probably be simplified a bit to:

Code: Select all

TAG POS=1 TYPE=INPUT:NUMBER ATTR=ID:control-5 CONTENT={{!COL3}}
EVENTS TYPE=KEYPRESS SELECTOR="#control-5" KEYS="[38,40]"
=> 'FORM' Parameter apparently not really needed, and some part in it looked a bit Dynamic to me..., and like I had already mentioned, the 'CLICK' Statement can probably be dismissed...

And Thanks for the Feedback/Follow-up and sharing your Solution... :D
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
ag5264
Posts: 7
Joined: Sat Jul 16, 2016 10:03 am

Re: Required field showing a validation error

Post by ag5264 » Fri May 24, 2019 3:31 am

Thanks for the feedback. I've removed a number of things and will have a look at your suggestion too.
chivracq
Posts: 8313
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Required field showing a validation error

Post by chivracq » Fri May 24, 2019 5:11 am

ag5264 wrote:
Fri May 24, 2019 3:31 am
Thanks for the feedback. I've removed a number of things and will have a look at your suggestion too.
Yeah well, it's more for you to "dig a bit into it" if you want to understand a bit better how iMacros and especially the 'EVENT' Mode work(s), as you sounded already nicely Comfortable/Advanced with this Mode... But no "real" Need of course to change anything if your Script already works like you want, ah-ah...! :wink:

But it's often very "interesting" to start from a (finally!) "working" Script and to change a few "things" that will break (again!) the Script, to understand and fine-tune your Script, for this time or some next time... :wink:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
Post Reply