Forms on website don't validate/save input via iMacros

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
Thrilling
Posts: 33
Joined: Fri Aug 11, 2017 2:02 pm

Forms on website don't validate/save input via iMacros

Post by Thrilling » Wed Oct 17, 2018 8:34 am

Hi,

I'm using iMacros 8.9.7 on FIrefox 45.9.0 ESR on Solaris 11.3 (x64, german)

I'm writing a script to automatically fill in forms from an excel-file.
When inputting data via iMacros script (data from the CSV-file or data written into the script itself, same result), this happens:
123jpg.jpg
The website doesn't recognize that the form was filled, so "next" can't be clicked. When i input data manually, and THEN execute the iMacros script, the error message doesn't appear, but when clicking "next" and then "back", the input data is replaced by numbers, in some fields "1", in some fields "2".

Description how to reach the page (this is a website to apply for an e-Visa to travel to Uzbekistan):
1. go here https://e-visa.gov.uz/main
2. click on "Application for e-Visa"
3. In the dropdown menu input "German", in the dropdrown menu "document type" input "ordinary passport", click next
4. click on any avaliable arrival and departure date, click next

Please help me with making the website validate and save data input via iMacros
chivracq
Posts: 8409
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Forms on website don't validate/save input via iMacros

Post by chivracq » Wed Oct 17, 2018 8:47 am

Thrilling wrote:Hi,

I'm using

Code: Select all

iMacros 8.9.7 on FIrefox 45.9.0 ESR on Solaris 11.3 (x64, german)
I'm writing a script to automatically fill in forms from an excel-file.
When inputting data via iMacros script (data from the CSV-file or data written into the script itself, same result), this happens:
123jpg.jpg
The website doesn't recognize that the form was filled, so "next" can't be clicked. When i input data manually, and THEN execute the iMacros script, the error message doesn't appear, but when clicking "next" and then "back", the input data is replaced by numbers, in some fields "1", in some fields "2".

Description how to reach the page (this is a website to apply for an e-Visa to travel to Uzbekistan):
1. go here https://e-visa.gov.uz/main
2. click on "Application for e-Visa"
3. In the dropdown menu input "German", in the dropdrown menu "document type" input "ordinary passport", click next
4. click on any avaliable arrival and departure date, click next

Please help me with making the website validate and save data input via iMacros
Post the Script you've tried corresponding to the Steps you describe for me to have a look... :idea:

"the error message doesn't appear" => What Error Msg...?
- (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...
Thrilling
Posts: 33
Joined: Fri Aug 11, 2017 2:02 pm

Re: Forms on website don't validate/save input via iMacros

Post by Thrilling » Wed Oct 17, 2018 8:52 am

Hi chivracq, long time no see :) thanks for helping

Error message: i meant the "required field" message as seen in the JPG

1. Script for Page 1

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1

TAG POS=1 TYPE=SELECT ATTR=ID:infoCitizenship CONTENT=%27
TAG POS=1 TYPE=SELECT ATTR=ID:applicantDocType CONTENT=%1
wait seconds=0.5
TAG POS=1 TYPE=BUTTON ATTR=TXT:Next<SP>arrow_forward
2. Script for Page 2

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !DATASOURCE_DELIMITER ;
SET !DATASOURCE Usbekistan.csv
SET !ERRORIGNORE YES

SET !DATASOURCE_LINE 2
SET !var1 EVAL("var ReisebeginnMonat = \"{{!col1}}\"; var x=ReisebeginnMonat.split('#'); var z=x[1]; z;")


SET !DATASOURCE_LINE 5
SET !VAR2 EVAL("var AktuellerMonat = \"{{!col1}}\"; AktuellerMonat") 

SET !var3 EVAL("var x = \"{{!var1}}\"; var y = \"{{!var2}}\"; var z=12; var a; x=x*1; y=y*1; if(x>=y){a=x-y;} else{a=z-y+x;} a;")

SET !var4 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>0){y=3;} else{y=0;}; y;")
SET !var5 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>1){y=3;} else{y=0;}; y;")
SET !var6 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>2){y=3;} else{y=0;}; y;")
SET !var7 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>3){y=3;} else{y=0;}; y;")
SET !var8 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>4){y=3;} else{y=0;}; y;")
SET !var9 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>5){y=3;} else{y=0;}; y;")

TAG POS={{!var4}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var5}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var6}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var7}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var8}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var9}} TYPE=BUTTON ATTR=TXT:


SET !DATASOURCE_LINE 2
SET !var1 EVAL("var ReisebeginnTag = \"{{!col1}}\"; var x=ReisebeginnTag.split('#'); var z=x[0]; z=z*1; z;")
TAG POS=2 TYPE=DIV ATTR=TXT:{{!var1}}


SET !var1 EVAL("var ReiseEndeMonat = \"{{!col3}}\"; var x=ReiseEndeMonat.split('#'); var z=x[1]; z;")

SET !DATASOURCE_LINE 5
SET !var3 EVAL("var x = \"{{!var1}}\"; var y = \"{{!var2}}\"; var z=12; var a; x=x*1; y=y*1; if(x>=y){a=x-y;} else{a=z-y+x;} a;")

SET !var4 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>0){y=5;} else{y=0;}; y;")
SET !var5 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>1){y=5;} else{y=0;}; y;")
SET !var6 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>2){y=5;} else{y=0;}; y;")
SET !var7 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>3){y=5;} else{y=0;}; y;")
SET !var8 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>4){y=5;} else{y=0;}; y;")
SET !var9 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>5){y=5;} else{y=0;}; y;")

TAG POS={{!var4}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var5}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var6}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var7}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var8}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var9}} TYPE=BUTTON ATTR=TXT:

SET !DATASOURCE_LINE 2
SET !var1 EVAL("var ReiseendeTag = \"{{!col3}}\"; var x=ReiseendeTag.split('#'); var z=x[0]; z=z*1; z;")
TAG POS=4 TYPE=DIV ATTR=TXT:{{!var1}}
Script for page 3 (the page with the problem)

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !DATASOURCE_DELIMITER ;
SET !DATASOURCE Usbekistan.csv
SET !ERRORIGNORE YES

SET !DATASOURCE_LINE 36
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantSurname CONTENT={{!col2}}

SET !VAR1 EVAL("var x='{{!COL4}}'; var y='{{!COL2}}'; var z; if(x==y){z='0';} else if(x=='NO'){z='0';} else if(x=='NEIN'){z='0';} else{z='1';}; z;")

TAG POS={{!var1}} TYPE=LABEL ATTR=TXT:Surname<SP>changed<SP>-<SP>NO
TAG POS={{!var1}} TYPE=INPUT:CHECKBOX ATTR=ID:applicantSurnameChanged CONTENT=YES
TAG POS={{!var1}} TYPE=INPUT:TEXT ATTR=ID:applicantPreviousSurname CONTENT={{!col4}}

TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantName CONTENT={{!col3}}

SET !var1 EVAL("var x = \"{{!col5}}\"; if(x=='F'){x=1;} else{x=0;}; x;")
SET !var2 EVAL("var x = \"{{!col5}}\"; if(x=='M'){x=1;} else{x=0;}; x;")

TAG POS={{!var1}} TYPE=LABEL ATTR=TXT:Female
TAG POS={{!var1}} TYPE=INPUT:RADIO ATTR=ID:applicantFemale
TAG POS={{!var2}} TYPE=LABEL ATTR=TXT:Male
TAG POS={{!var2}} TYPE=INPUT:RADIO ATTR=ID:applicantMale

TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantBirthday CONTENT={{!col6}}
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantBirthPlace CONTENT={{!col7}}
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantDocSeriesNumber CONTENT={{!col11}}

SET !var1 EVAL("var AusstellungsJahr = \"{{!col9}}\"; var x=AusstellungsJahr.split('.'); var z=x[2]; z;")
SET !var2 EVAL("var AusstellungsMonat = \"{{!col9}}\"; var x=AusstellungsMonat.split('.'); var z=x[1]; z=z*1; z;")
SET !var3 EVAL("var AusstellungsTag = \"{{!col9}}\"; var x=AusstellungsTag.split('.'); var z=x[0]; z=z*1; z;")

TAG POS=1 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=1 TYPE=SELECT ATTR=TXT:190019011902190319041905190619071908190919101911191219131914* CONTENT=%{{!var1}}
TAG POS=1 TYPE=SELECT ATTR=TXT:JanFebMarAprMayJunJulAugSepOctNovDec CONTENT=%{{!var2}}
TAG POS=2 TYPE=DIV ATTR=TXT:{{!var3}}

SET !var1 EVAL("var GueltigBisJahr = \"{{!col10}}\"; var x=GueltigBisJahr.split('.'); var z=x[2]; z;")
SET !var2 EVAL("var GueltigBisMonat = \"{{!col10}}\"; var x=GueltigBisMonat.split('.'); var z=x[1]; z=z*1; z;")
SET !var3 EVAL("var GueltigBisTag = \"{{!col10}}\"; var x=GueltigBisTag.split('.'); var z=x[0]; z=z*1; z;")

TAG POS=2 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=1 TYPE=SELECT ATTR=TXT:190019011902190319041905190619071908190919101911191219131914* CONTENT=%{{!var1}}
TAG POS=1 TYPE=SELECT ATTR=TXT:JanFebMarAprMayJunJulAugSepOctNovDec CONTENT=%{{!var2}}
TAG POS=2 TYPE=DIV ATTR=TXT:{{!var3}}

TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantPermanentResidence CONTENT={{!col12}}
chivracq
Posts: 8409
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Forms on website don't validate/save input via iMacros

Post by chivracq » Wed Oct 17, 2018 9:05 am

Hum, OK, don't worry, I had a look at the Site already (which doesn't work at all on my Default Browser; Pale Moon v26.3.3 (+ iMacros for FF v8.8.2)), but the following Script works directly for me on FF v55.0.3 to fill in and pass the first 2 Screens to reach the 'Personal Information' (3rd) Screen:

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
URL GOTO=https://e-visa.gov.uz/main
TAG POS=1 TYPE=P ATTR=TXT:Official<SP>electronic<SP>visa<SP>portalof<SP>the<SP>Republi*
TAG POS=1 TYPE=SECTION ATTR=TXT:e-Visa<SP>Official<SP>electronic<SP>visa<SP>portalof<SP>the*
TAG POS=1 TYPE=DIV ATTR=TXT:Legislation<SP>Need<SP>tо<SP>know<SP>Feedback<SP>phoneHot*
TAG POS=1 TYPE=P ATTR=TXT:phoneHot<SP>line:<SP>+998<SP>71<SP>200<SP>00<SP>88
TAG POS=6 TYPE=DIV ATTR=TXT:Application<SP>for<SP>e-visa<SP>Filling<SP>out<SP>a<SP>form*
TAG POS=1 TYPE=P ATTR=TXT:Official<SP>electronic<SP>visa<SP>portalof<SP>the<SP>Republi*
'>
TAG POS=1 TYPE=SECTION ATTR=TXT:e-Visa<SP>Official<SP>electronic<SP>visa<SP>portalof<SP>the*
WAIT SECONDS=2
'PAUSE

TAG POS=1 TYPE=LABEL ATTR=TXT:Citizenship
TAG POS=1 TYPE=SELECT ATTR=ID:infoCitizenship CONTENT=%27
WAIT SECONDS=1

TAG POS=1 TYPE=LABEL ATTR=TXT:Document<SP>type
TAG POS=1 TYPE=SELECT ATTR=ID:applicantDocType CONTENT=%1

TAG POS=1 TYPE=LABEL ATTR=TXT:Purpose<SP>of<SP>visit
TAG POS=1 TYPE=BUTTON ATTR=TXT:Next<SP>arrow_forward
'PAUSE

TAG POS=1 TYPE=P ATTR=TXT:Electronic<SP>application<SP>form<SP>for<SP>receiving<SP>an*
TAG POS=1 TYPE=H6 ATTR=TXT:Arrival<SP>date
TAG POS=2 TYPE=DIV ATTR=TXT:26
TAG POS=1 TYPE=P ATTR=TXT:Select<SP>departure<SP>date
TAG POS=1 TYPE=H6 ATTR=TXT:Departure<SP>date
TAG POS=4 TYPE=DIV ATTR=TXT:31
TAG POS=1 TYPE=BUTTON ATTR=TXT:Next<SP>arrow_forward
(Tested on iMacros for FF v8.9.7, FF v55.0.3, Win10_x64.)
- (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...
Thrilling
Posts: 33
Joined: Fri Aug 11, 2017 2:02 pm

Re: Forms on website don't validate/save input via iMacros

Post by Thrilling » Wed Oct 17, 2018 9:17 am

Dear chivracq,

thanks again for the help. The problem only appears on Page 3, which is my third script. Script/Page 1 and 2 work fine for me too
Thrilling
Posts: 33
Joined: Fri Aug 11, 2017 2:02 pm

Re: Forms on website don't validate/save input via iMacros

Post by Thrilling » Thu Oct 18, 2018 11:56 am

Dear chivracq,

Maybe you missed my last post, the problem isn't solved yet :) please help
chivracq
Posts: 8409
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Forms on website don't validate/save input via iMacros

Post by chivracq » Thu Oct 18, 2018 12:08 pm

Thrilling wrote:Hi chivracq, long time no see :) thanks for helping

Error message: i meant the "required field" message as seen in the JPG

1. Script for Page 1

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1

TAG POS=1 TYPE=SELECT ATTR=ID:infoCitizenship CONTENT=%27
TAG POS=1 TYPE=SELECT ATTR=ID:applicantDocType CONTENT=%1
wait seconds=0.5
TAG POS=1 TYPE=BUTTON ATTR=TXT:Next<SP>arrow_forward
2. Script for Page 2

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !DATASOURCE_DELIMITER ;
SET !DATASOURCE Usbekistan.csv
SET !ERRORIGNORE YES

SET !DATASOURCE_LINE 2
SET !var1 EVAL("var ReisebeginnMonat = \"{{!col1}}\"; var x=ReisebeginnMonat.split('#'); var z=x[1]; z;")


SET !DATASOURCE_LINE 5
SET !VAR2 EVAL("var AktuellerMonat = \"{{!col1}}\"; AktuellerMonat") 

SET !var3 EVAL("var x = \"{{!var1}}\"; var y = \"{{!var2}}\"; var z=12; var a; x=x*1; y=y*1; if(x>=y){a=x-y;} else{a=z-y+x;} a;")

SET !var4 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>0){y=3;} else{y=0;}; y;")
SET !var5 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>1){y=3;} else{y=0;}; y;")
SET !var6 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>2){y=3;} else{y=0;}; y;")
SET !var7 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>3){y=3;} else{y=0;}; y;")
SET !var8 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>4){y=3;} else{y=0;}; y;")
SET !var9 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>5){y=3;} else{y=0;}; y;")

TAG POS={{!var4}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var5}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var6}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var7}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var8}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var9}} TYPE=BUTTON ATTR=TXT:


SET !DATASOURCE_LINE 2
SET !var1 EVAL("var ReisebeginnTag = \"{{!col1}}\"; var x=ReisebeginnTag.split('#'); var z=x[0]; z=z*1; z;")
TAG POS=2 TYPE=DIV ATTR=TXT:{{!var1}}


SET !var1 EVAL("var ReiseEndeMonat = \"{{!col3}}\"; var x=ReiseEndeMonat.split('#'); var z=x[1]; z;")

SET !DATASOURCE_LINE 5
SET !var3 EVAL("var x = \"{{!var1}}\"; var y = \"{{!var2}}\"; var z=12; var a; x=x*1; y=y*1; if(x>=y){a=x-y;} else{a=z-y+x;} a;")

SET !var4 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>0){y=5;} else{y=0;}; y;")
SET !var5 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>1){y=5;} else{y=0;}; y;")
SET !var6 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>2){y=5;} else{y=0;}; y;")
SET !var7 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>3){y=5;} else{y=0;}; y;")
SET !var8 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>4){y=5;} else{y=0;}; y;")
SET !var9 EVAL("var x = \"{{!var3}}\"; var y; x=x*1; if(x>5){y=5;} else{y=0;}; y;")

TAG POS={{!var4}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var5}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var6}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var7}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var8}} TYPE=BUTTON ATTR=TXT:
TAG POS={{!var9}} TYPE=BUTTON ATTR=TXT:

SET !DATASOURCE_LINE 2
SET !var1 EVAL("var ReiseendeTag = \"{{!col3}}\"; var x=ReiseendeTag.split('#'); var z=x[0]; z=z*1; z;")
TAG POS=4 TYPE=DIV ATTR=TXT:{{!var1}}
Script for page 3 (the page with the problem)

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !DATASOURCE_DELIMITER ;
SET !DATASOURCE Usbekistan.csv
SET !ERRORIGNORE YES

SET !DATASOURCE_LINE 36
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantSurname CONTENT={{!col2}}

SET !VAR1 EVAL("var x='{{!COL4}}'; var y='{{!COL2}}'; var z; if(x==y){z='0';} else if(x=='NO'){z='0';} else if(x=='NEIN'){z='0';} else{z='1';}; z;")

TAG POS={{!var1}} TYPE=LABEL ATTR=TXT:Surname<SP>changed<SP>-<SP>NO
TAG POS={{!var1}} TYPE=INPUT:CHECKBOX ATTR=ID:applicantSurnameChanged CONTENT=YES
TAG POS={{!var1}} TYPE=INPUT:TEXT ATTR=ID:applicantPreviousSurname CONTENT={{!col4}}

TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantName CONTENT={{!col3}}

SET !var1 EVAL("var x = \"{{!col5}}\"; if(x=='F'){x=1;} else{x=0;}; x;")
SET !var2 EVAL("var x = \"{{!col5}}\"; if(x=='M'){x=1;} else{x=0;}; x;")

TAG POS={{!var1}} TYPE=LABEL ATTR=TXT:Female
TAG POS={{!var1}} TYPE=INPUT:RADIO ATTR=ID:applicantFemale
TAG POS={{!var2}} TYPE=LABEL ATTR=TXT:Male
TAG POS={{!var2}} TYPE=INPUT:RADIO ATTR=ID:applicantMale

TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantBirthday CONTENT={{!col6}}
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantBirthPlace CONTENT={{!col7}}
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantDocSeriesNumber CONTENT={{!col11}}

SET !var1 EVAL("var AusstellungsJahr = \"{{!col9}}\"; var x=AusstellungsJahr.split('.'); var z=x[2]; z;")
SET !var2 EVAL("var AusstellungsMonat = \"{{!col9}}\"; var x=AusstellungsMonat.split('.'); var z=x[1]; z=z*1; z;")
SET !var3 EVAL("var AusstellungsTag = \"{{!col9}}\"; var x=AusstellungsTag.split('.'); var z=x[0]; z=z*1; z;")

TAG POS=1 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=1 TYPE=SELECT ATTR=TXT:190019011902190319041905190619071908190919101911191219131914* CONTENT=%{{!var1}}
TAG POS=1 TYPE=SELECT ATTR=TXT:JanFebMarAprMayJunJulAugSepOctNovDec CONTENT=%{{!var2}}
TAG POS=2 TYPE=DIV ATTR=TXT:{{!var3}}

SET !var1 EVAL("var GueltigBisJahr = \"{{!col10}}\"; var x=GueltigBisJahr.split('.'); var z=x[2]; z;")
SET !var2 EVAL("var GueltigBisMonat = \"{{!col10}}\"; var x=GueltigBisMonat.split('.'); var z=x[1]; z=z*1; z;")
SET !var3 EVAL("var GueltigBisTag = \"{{!col10}}\"; var x=GueltigBisTag.split('.'); var z=x[0]; z=z*1; z;")

TAG POS=2 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=1 TYPE=SELECT ATTR=TXT:190019011902190319041905190619071908190919101911191219131914* CONTENT=%{{!var1}}
TAG POS=1 TYPE=SELECT ATTR=TXT:JanFebMarAprMayJunJulAugSepOctNovDec CONTENT=%{{!var2}}
TAG POS=2 TYPE=DIV ATTR=TXT:{{!var3}}

TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantPermanentResidence CONTENT={{!col12}}
Thrilling wrote:Dear chivracq,

thanks again for the help. The problem only appears on Page 3, which is my third script. Script/Page 1 and 2 work fine for me too
Thrilling wrote:Dear chivracq,

Maybe you missed my last post, the problem isn't solved yet :) please help
No-no, I had seen it indeed, but I need to go "digging" again into/onto this Site, and your Script makes use of a '.CSV' DataSource which doesn't help me that much..., so I still need to record "my own" Script anyway to be able to do any Digging/Testing, and I suspect the 'Passport' Field will probably have some JS Validation on the Format (which I don't know), so that will be a bit of a "hassle" for me to bypass that Validation, and the Forum is a bit "busy" at the moment..., and me also actually..., so I didn't have the time to dig into your Thread again... :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...
Thrilling
Posts: 33
Joined: Fri Aug 11, 2017 2:02 pm

Re: Forms on website don't validate/save input via iMacros

Post by Thrilling » Thu Oct 18, 2018 12:43 pm

Sorry, I'll be more patient. Here's a script without .CSV requirement i just made, that takes you to page 3 and fills it

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
URL GOTO=https://e-visa.gov.uz/main
TAG POS=1 TYPE=P ATTR=TXT:Filling<SP>out<SP>a<SP>form<SP>for<SP>receiving<SP>an<SP>ele*
wait seconds=2
TAG POS=1 TYPE=SELECT ATTR=ID:infoCitizenship CONTENT=%27
wait seconds=0.5
TAG POS=1 TYPE=SELECT ATTR=ID:applicantDocType CONTENT=%1
wait seconds=0.5
TAG POS=1 TYPE=BUTTON ATTR=TXT:Next<SP>arrow_forward
TAG POS=2 TYPE=DIV ATTR=TXT:19
TAG POS=4 TYPE=DIV ATTR=TXT:25
TAG POS=1 TYPE=BUTTON ATTR=TXT:Next<SP>arrow_forward
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantSurname CONTENT=asd
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantName CONTENT=asd
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantBirthday CONTENT=17.09.1987
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantBirthPlace CONTENT=asd
TAG POS=1 TYPE=LABEL ATTR=TXT:Male
TAG POS=1 TYPE=INPUT:RADIO ATTR=ID:applicantMale
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantDocSeriesNumber CONTENT=123123123
TAG POS=1 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=2 TYPE=BUTTON ATTR=TXT:
TAG POS=2 TYPE=DIV ATTR=TXT:17
TAG POS=2 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=1 TYPE=SELECT ATTR=TXT:190019011902190319041905190619071908190919101911191219131914* CONTENT=%2026
TAG POS=2 TYPE=DIV ATTR=TXT:16
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantPermanentResidence CONTENT=asdasdasd
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantWorkPosition CONTENT=asdasda
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantPhoneNumber CONTENT=324234234
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantPreliminaryPlaceResidence CONTENT=asdasdas
chivracq
Posts: 8409
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Forms on website don't validate/save input via iMacros

Post by chivracq » Thu Oct 18, 2018 1:34 pm

Thrilling wrote:Sorry, I'll be more patient. Here's a script without .CSV requirement i just made, that takes you to page 3 and fills it

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
URL GOTO=https://e-visa.gov.uz/main
TAG POS=1 TYPE=P ATTR=TXT:Filling<SP>out<SP>a<SP>form<SP>for<SP>receiving<SP>an<SP>ele*
wait seconds=2
TAG POS=1 TYPE=SELECT ATTR=ID:infoCitizenship CONTENT=%27
wait seconds=0.5
TAG POS=1 TYPE=SELECT ATTR=ID:applicantDocType CONTENT=%1
wait seconds=0.5
TAG POS=1 TYPE=BUTTON ATTR=TXT:Next<SP>arrow_forward
TAG POS=2 TYPE=DIV ATTR=TXT:19
TAG POS=4 TYPE=DIV ATTR=TXT:25
TAG POS=1 TYPE=BUTTON ATTR=TXT:Next<SP>arrow_forward
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantSurname CONTENT=asd
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantName CONTENT=asd
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantBirthday CONTENT=17.09.1987
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantBirthPlace CONTENT=asd
TAG POS=1 TYPE=LABEL ATTR=TXT:Male
TAG POS=1 TYPE=INPUT:RADIO ATTR=ID:applicantMale
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantDocSeriesNumber CONTENT=123123123
TAG POS=1 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=2 TYPE=BUTTON ATTR=TXT:
TAG POS=2 TYPE=DIV ATTR=TXT:17
TAG POS=2 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=1 TYPE=SELECT ATTR=TXT:190019011902190319041905190619071908190919101911191219131914* CONTENT=%2026
TAG POS=2 TYPE=DIV ATTR=TXT:16
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantPermanentResidence CONTENT=asdasdasd
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantWorkPosition CONTENT=asdasda
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantPhoneNumber CONTENT=324234234
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantPreliminaryPlaceResidence CONTENT=asdasdas
OK, that's a bit easier for me indeed, then I was able to give it another go...

And hum, most Fields indeed on this 3rd Screen trigger some "Field required" Validation Error using the 'TAG' Mode, even if all Fields do get filled in by the Script..., but from some "quick and dirty" Testing, the 'EVENT' Mode then seems to work on this Page...:

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
URL GOTO=https://e-visa.gov.uz/main
TAG POS=1 TYPE=P ATTR=TXT:Filling<SP>out<SP>a<SP>form<SP>for<SP>receiving<SP>an<SP>ele*
wait seconds=2
TAG POS=1 TYPE=SELECT ATTR=ID:infoCitizenship CONTENT=%27
wait seconds=0.5
TAG POS=1 TYPE=SELECT ATTR=ID:applicantDocType CONTENT=%1
wait seconds=0.5
TAG POS=1 TYPE=BUTTON ATTR=TXT:Next<SP>arrow_forward
TAG POS=2 TYPE=DIV ATTR=TXT:19
TAG POS=4 TYPE=DIV ATTR=TXT:25
TAG POS=1 TYPE=BUTTON ATTR=TXT:Next<SP>arrow_forward
PAUSE

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>LABEL" BUTTON=0
EVENT TYPE=CLICK SELECTOR="#applicantSurname" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantSurname" CHARS="dfg"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>LABEL" BUTTON=0
EVENT TYPE=CLICK SELECTOR="#applicantName" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantName" CHARS="ghfghh"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV:nth-of-type(3)>DIV>DIV>LABEL" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(4)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantBirthday" CHARS="17091987"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(4)>DIV:nth-of-type(2)>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantBirthPlace" CHARS="gfjffjj"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(5)>DIV>H6" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(7)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantDocSeriesNumber" CHARS="123123123"

TAG POS=1 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=2 TYPE=BUTTON ATTR=TXT:
TAG POS=2 TYPE=DIV ATTR=TXT:17
TAG POS=2 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=1 TYPE=SELECT ATTR=TXT:190019011902190319041905190619071908190919101911191219131914* CONTENT=%2026
TAG POS=2 TYPE=DIV ATTR=TXT:16

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(7)>DIV:nth-of-type(2)>LABEL" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(7)>DIV:nth-of-type(3)>LABEL" BUTTON=0

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(8)>DIV>H6" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(9)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPermanentResidence" CHARS="dgdggdh dgdgd 16"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(10)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantWorkPosition" CHARS="ghjghjhghj"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(11)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPhoneNumber" CHARS="0678987654"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(12)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPreliminaryPlaceResidence" CHARS="uzbekcity"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(8)>DIV>H6" BUTTON=0
EVENT TYPE=MOUSEDOWN SELECTOR="HTML" BUTTON=0
EVENT TYPE=MOUSEUP POINT="(798,960)"

PAUSE

SET !SINGLESTEP YES
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantSurname CONTENT=asd
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantName CONTENT=asd
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantBirthday CONTENT=17.09.1987
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantBirthPlace CONTENT=asd
TAG POS=1 TYPE=LABEL ATTR=TXT:Male
TAG POS=1 TYPE=INPUT:RADIO ATTR=ID:applicantMale
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantDocSeriesNumber CONTENT=123123123
TAG POS=1 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=2 TYPE=BUTTON ATTR=TXT:
TAG POS=2 TYPE=DIV ATTR=TXT:17
TAG POS=2 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=1 TYPE=SELECT ATTR=TXT:190019011902190319041905190619071908190919101911191219131914* CONTENT=%2026
TAG POS=2 TYPE=DIV ATTR=TXT:16
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantPermanentResidence CONTENT=asdasdasd
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantWorkPosition CONTENT=asdasda
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantPhoneNumber CONTENT=324234234
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:applicantPreliminaryPlaceResidence CONTENT=asdasdas
(Tested on iMacros for FF v8.9.7, FF v55.0.3, Win10_x64.)
- (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...
Thrilling
Posts: 33
Joined: Fri Aug 11, 2017 2:02 pm

Re: Forms on website don't validate/save input via iMacros

Post by Thrilling » Fri Oct 19, 2018 8:17 am

Dear chivracq,

this seems to work nicely for solving the main problem. But now I need to know how to "disable" a line if a condition is met. Please see the following, non-EVENT-mode code:

Code: Select all

SET !VAR1 EVAL("var x='{{!COL4}}'; var y='{{!COL2}}'; var z; if(x==y){z='0';} else if(x=='NO'){z='0';} else if(x=='NEIN'){z='0';} else{z='1';}; z;")

TAG POS={{!var1}} TYPE=LABEL ATTR=TXT:Surname<SP>changed<SP>-<SP>NO
TAG POS={{!var1}} TYPE=INPUT:CHECKBOX ATTR=ID:applicantSurnameChanged CONTENT=YES
TAG POS={{!var1}} TYPE=INPUT:TEXT ATTR=ID:applicantPreviousSurname CONTENT={{!col4}}
As you can see I'm disabling the input, if certain conditions are met. Is it possible to disable the new code you sent me, if conditions are met? Where? Here's the relevant code in Event mode:

Code: Select all

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>LABEL" BUTTON=0
EVENT TYPE=CLICK SELECTOR="#applicantPreviousSurname" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPreviousSurname" CHARS="asd"
chivracq
Posts: 8409
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Forms on website don't validate/save input via iMacros

Post by chivracq » Fri Oct 19, 2018 8:38 am

Thrilling wrote:Dear chivracq,

this seems to work nicely for solving the main problem. But now I need to know how to "disable" a line if a condition is met. Please see the following, non-EVENT-mode code:

Code: Select all

SET !VAR1 EVAL("var x='{{!COL4}}'; var y='{{!COL2}}'; var z; if(x==y){z='0';} else if(x=='NO'){z='0';} else if(x=='NEIN'){z='0';} else{z='1';}; z;")

TAG POS={{!var1}} TYPE=LABEL ATTR=TXT:Surname<SP>changed<SP>-<SP>NO
TAG POS={{!var1}} TYPE=INPUT:CHECKBOX ATTR=ID:applicantSurnameChanged CONTENT=YES
TAG POS={{!var1}} TYPE=INPUT:TEXT ATTR=ID:applicantPreviousSurname CONTENT={{!col4}}
As you can see I'm disabling the input, if certain conditions are met. Is it possible to disable the new code you sent me, if conditions are met? Where? Here's the relevant code in Event mode:

Code: Select all

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>LABEL" BUTTON=0
EVENT TYPE=CLICK SELECTOR="#applicantPreviousSurname" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPreviousSurname" CHARS="asd"
OK, good News already...

Well, for the Conditional part(s), simply use the same Principle with 'EVAL()' and instead of returning a 1/0 to reuse on the 'POS=n' Parameter, compute any other applicable Number or String to reuse for any of the Parameters for each 'EVENT' Statement, like 0/9 for example for 'BUTTON=n', I guess 'BUTTON=9' won't do anything, but you can compute the Selector String as well, and I guess you can even compute a String called "CLICK" or "KEYPRESS(ES)" or some fake Type that doesn't exist for the 'TYPE' Parameter, I've never tried on the 'EVENT' Mode but I use it on the 'TAG' Mode where I dynamically compute "DIV" or "SPAN" or stg else as a String, and there is no Validation at Parsing Time, there is no way the Compiler will know already what String/Type my 'EVAL()' Statements are computing for some 'TAG POS=1 TYPE={{!VAR1}}' Statements, so I guess it will work as well with the 'EVENT' Mode... :idea:

:!: The only "Danger" I know with this "Method" is for a 'MOUSEMOVE' Statement if you compute a fake Selector String that doesn't exist, the Script will then hang at the following Line... Some Workaround is then to compute "BODY" which will always exist, and a 'MOUSEMOVE' on 'BODY' won't do anything but the Script won't hang... (But you don't have/need any 'MOUSEMOVE' in your Script, so you won't encounter this Issue anyway...)
- (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...
Thrilling
Posts: 33
Joined: Fri Aug 11, 2017 2:02 pm

Re: Forms on website don't validate/save input via iMacros

Post by Thrilling » Fri Oct 19, 2018 10:11 am

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !DATASOURCE_DELIMITER ;
SET !DATASOURCE Usbekistan.csv
SET !ERRORIGNORE YES

SET !DATASOURCE_LINE 36

SET !VAR1 EVAL("var x='{{!COL4}}'; var y='{{!COL2}}'; var z; if(x==y){z='9';} else if(x=='NO'){z='9';} else if(x=='NEIN'){z='9';} else{z='0';}; z;")

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>LABEL" BUTTON={{!var1}}
EVENT TYPE=CLICK SELECTOR="#applicantPreviousSurname" BUTTON={{!var1}}
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPreviousSurname" CHARS="{{!col4}}"
Using "9" for the "Button =" command lags the macro when executing it, I get the "element waiting" message for 5 seconds per line trying to execute the "9", then it jumps to the next line successfully. Is there a command to skip the waiting time?

Same result when swapping "CLICK" with "KEYPRESS":
VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !DATASOURCE_DELIMITER ;
SET !DATASOURCE Usbekistan.csv
SET !ERRORIGNORE YES

SET !DATASOURCE_LINE 36

SET !VAR1 EVAL("var x='{{!COL4}}'; var y='{{!COL2}}'; var z; if(x==y){z='KEYPRESS';} else if(x=='NO'){z='KEYPRESS';} else if(x=='NEIN'){z='KEYPRESS';} else{z='CLICK';}; z;")

EVENT TYPE={{!var1}} SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>LABEL" BUTTON=0
EVENT TYPE={{!var1}} SELECTOR="#applicantPreviousSurname" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPreviousSurname" CHARS="{{!col4}}"
chivracq
Posts: 8409
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Forms on website don't validate/save input via iMacros

Post by chivracq » Fri Oct 19, 2018 10:16 am

Thrilling wrote:

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !DATASOURCE_DELIMITER ;
SET !DATASOURCE Usbekistan.csv
SET !ERRORIGNORE YES

SET !DATASOURCE_LINE 36

SET !VAR1 EVAL("var x='{{!COL4}}'; var y='{{!COL2}}'; var z; if(x==y){z='9';} else if(x=='NO'){z='9';} else if(x=='NEIN'){z='9';} else{z='0';}; z;")

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>LABEL" BUTTON={{!var1}}
EVENT TYPE=CLICK SELECTOR="#applicantPreviousSurname" BUTTON={{!var1}}
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPreviousSurname" CHARS="{{!col4}}"
Using "9" for the "Button =" command lags the macro when executing it, I get the "element waiting" message for 5 seconds per line trying to execute the "9", then it jumps to the next line successfully. Is there a command to skip the waiting time?

Same result when swapping "CLICK" with KEYPRESS":

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !DATASOURCE_DELIMITER ;
SET !DATASOURCE Usbekistan.csv
SET !ERRORIGNORE YES

SET !DATASOURCE_LINE 36

SET !VAR1 EVAL("var x='{{!COL4}}'; var y='{{!COL2}}'; var z; if(x==y){z='KEYPRESS';} else if(x=='NO'){z='KEYPRESS';} else if(x=='NEIN'){z='KEYPRESS';} else{z='CLICK';}; z;")

EVENT TYPE={{!var1}} SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>LABEL" BUTTON=0
EVENT TYPE={{!var1}} SELECTOR="#applicantPreviousSurname" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPreviousSurname" CHARS="{{!col4}}"
Yep, of course, normal, but you would get the same "Behaviour" with a 'TAG POS=0' also, you need to shorten '!TIMEOUT_STEP' to "1" or "0".
- (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...
Thrilling
Posts: 33
Joined: Fri Aug 11, 2017 2:02 pm

Re: Forms on website don't validate/save input via iMacros

Post by Thrilling » Fri Oct 19, 2018 10:51 am

Works like a charm, thank you SO much, again, for your kind help dear chivracq, this'll make our life MUCH easier. FYI: I don't need the TIMEOUT STEP command for my other, non-EVENT macros, even when i replace "0" with a conditional VAR in TAG POS=0 :D

I'm amazed at iMacros yet again, i didn't know you could simulate clicking/keystrokes!

Here the working EVENT Macro script:
VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !DATASOURCE_DELIMITER ;
SET !DATASOURCE Usbekistan.csv
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0

SET !DATASOURCE_LINE 36

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>LABEL" BUTTON=0
EVENT TYPE=CLICK SELECTOR="#applicantSurname" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantSurname" CHARS="{{!col2}}"

SET !VAR1 EVAL("var x='{{!COL4}}'; var y='{{!COL2}}'; var z; if(x==y){z='9';} else if(x=='NO'){z='9';} else if(x=='NEIN'){z='9';} else{z='0';}; z;")

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>LABEL" BUTTON={{!var1}}
EVENT TYPE=CLICK SELECTOR="#applicantPreviousSurname" BUTTON={{!var1}}
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPreviousSurname" CHARS="{{!col4}}"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>LABEL" BUTTON=0
EVENT TYPE=CLICK SELECTOR="#applicantName" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantName" CHARS="{{!col3}}"

SET !var1 EVAL("var x = \"{{!col5}}\"; if(x=='F'){x=1;} else{x=0;}; x;")
SET !var2 EVAL("var x = \"{{!col5}}\"; if(x=='M'){x=1;} else{x=0;}; x;")

TAG POS={{!var1}} TYPE=LABEL ATTR=TXT:Female
TAG POS={{!var1}} TYPE=INPUT:RADIO ATTR=ID:applicantFemale
TAG POS={{!var2}} TYPE=LABEL ATTR=TXT:Male
TAG POS={{!var2}} TYPE=INPUT:RADIO ATTR=ID:applicantMale

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV:nth-of-type(3)>DIV>DIV>LABEL" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(4)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantBirthday" CHARS="{{!col6}}"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(4)>DIV:nth-of-type(2)>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantBirthPlace" CHARS="{{!col7}}"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(5)>DIV>H6" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(7)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantDocSeriesNumber" CHARS="{{!col11}}"

SET !var1 EVAL("var AusstellungsJahr = \"{{!col9}}\"; var x=AusstellungsJahr.split('.'); var z=x[2]; z;")
SET !var2 EVAL("var AusstellungsMonat = \"{{!col9}}\"; var x=AusstellungsMonat.split('.'); var z=x[1]; z=z*1; z;")
SET !var3 EVAL("var AusstellungsTag = \"{{!col9}}\"; var x=AusstellungsTag.split('.'); var z=x[0]; z=z*1; z;")

TAG POS=1 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=1 TYPE=SELECT ATTR=TXT:190019011902190319041905190619071908190919101911191219131914* CONTENT=%{{!var1}}
TAG POS=1 TYPE=SELECT ATTR=TXT:JanFebMarAprMayJunJulAugSepOctNovDec CONTENT=%{{!var2}}
TAG POS=2 TYPE=DIV ATTR=TXT:{{!var3}}

SET !var1 EVAL("var GueltigBisJahr = \"{{!col10}}\"; var x=GueltigBisJahr.split('.'); var z=x[2]; z;")
SET !var2 EVAL("var GueltigBisMonat = \"{{!col10}}\"; var x=GueltigBisMonat.split('.'); var z=x[1]; z=z*1; z;")
SET !var3 EVAL("var GueltigBisTag = \"{{!col10}}\"; var x=GueltigBisTag.split('.'); var z=x[0]; z=z*1; z;")

TAG POS=2 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=1 TYPE=SELECT ATTR=TXT:190019011902190319041905190619071908190919101911191219131914* CONTENT=%{{!var1}}
TAG POS=1 TYPE=SELECT ATTR=TXT:JanFebMarAprMayJunJulAugSepOctNovDec CONTENT=%{{!var2}}
TAG POS=2 TYPE=DIV ATTR=TXT:{{!var3}}

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(8)>DIV>H6" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(9)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPermanentResidence" CHARS="{{!col12}}"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(10)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantWorkPosition" CHARS="{{!col15}}, {{!col14}}"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(11)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPhoneNumber" CHARS="{{!col13}}"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(12)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPreliminaryPlaceResidence" CHARS="Roundtrip"
chivracq
Posts: 8409
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Forms on website don't validate/save input via iMacros

Post by chivracq » Fri Oct 19, 2018 11:22 am

Thrilling wrote:Works like a charm, thank you SO much, again, for your kind help dear chivracq, this'll make our life MUCH easier. FYI: I don't need the TIMEOUT STEP command for my other, non-EVENT macros, even when i replace "0" with a conditional VAR in TAG POS=0 :D

I'm amazed at iMacros yet again, i didn't know you could simulate clicking/keystrokes!

Here the working EVENT Macro script:

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !DATASOURCE_DELIMITER ;
SET !DATASOURCE Usbekistan.csv
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0

SET !DATASOURCE_LINE 36

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>LABEL" BUTTON=0
EVENT TYPE=CLICK SELECTOR="#applicantSurname" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantSurname" CHARS="{{!col2}}"

SET !VAR1 EVAL("var x='{{!COL4}}'; var y='{{!COL2}}'; var z; if(x==y){z='9';} else if(x=='NO'){z='9';} else if(x=='NEIN'){z='9';} else{z='0';}; z;")

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>LABEL" BUTTON={{!var1}}
EVENT TYPE=CLICK SELECTOR="#applicantPreviousSurname" BUTTON={{!var1}}
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPreviousSurname" CHARS="{{!col4}}"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>LABEL" BUTTON=0
EVENT TYPE=CLICK SELECTOR="#applicantName" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantName" CHARS="{{!col3}}"

SET !var1 EVAL("var x = \"{{!col5}}\"; if(x=='F'){x=1;} else{x=0;}; x;")
SET !var2 EVAL("var x = \"{{!col5}}\"; if(x=='M'){x=1;} else{x=0;}; x;")

TAG POS={{!var1}} TYPE=LABEL ATTR=TXT:Female
TAG POS={{!var1}} TYPE=INPUT:RADIO ATTR=ID:applicantFemale
TAG POS={{!var2}} TYPE=LABEL ATTR=TXT:Male
TAG POS={{!var2}} TYPE=INPUT:RADIO ATTR=ID:applicantMale

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV:nth-of-type(3)>DIV>DIV>LABEL" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(4)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantBirthday" CHARS="{{!col6}}"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(4)>DIV:nth-of-type(2)>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantBirthPlace" CHARS="{{!col7}}"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(5)>DIV>H6" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(7)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantDocSeriesNumber" CHARS="{{!col11}}"

SET !var1 EVAL("var AusstellungsJahr = \"{{!col9}}\"; var x=AusstellungsJahr.split('.'); var z=x[2]; z;")
SET !var2 EVAL("var AusstellungsMonat = \"{{!col9}}\"; var x=AusstellungsMonat.split('.'); var z=x[1]; z=z*1; z;")
SET !var3 EVAL("var AusstellungsTag = \"{{!col9}}\"; var x=AusstellungsTag.split('.'); var z=x[0]; z=z*1; z;")

TAG POS=1 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=1 TYPE=SELECT ATTR=TXT:190019011902190319041905190619071908190919101911191219131914* CONTENT=%{{!var1}}
TAG POS=1 TYPE=SELECT ATTR=TXT:JanFebMarAprMayJunJulAugSepOctNovDec CONTENT=%{{!var2}}
TAG POS=2 TYPE=DIV ATTR=TXT:{{!var3}}

SET !var1 EVAL("var GueltigBisJahr = \"{{!col10}}\"; var x=GueltigBisJahr.split('.'); var z=x[2]; z;")
SET !var2 EVAL("var GueltigBisMonat = \"{{!col10}}\"; var x=GueltigBisMonat.split('.'); var z=x[1]; z=z*1; z;")
SET !var3 EVAL("var GueltigBisTag = \"{{!col10}}\"; var x=GueltigBisTag.split('.'); var z=x[0]; z=z*1; z;")

TAG POS=2 TYPE=BUTTON ATTR=TXT:date_range
TAG POS=1 TYPE=SELECT ATTR=TXT:190019011902190319041905190619071908190919101911191219131914* CONTENT=%{{!var1}}
TAG POS=1 TYPE=SELECT ATTR=TXT:JanFebMarAprMayJunJulAugSepOctNovDec CONTENT=%{{!var2}}
TAG POS=2 TYPE=DIV ATTR=TXT:{{!var3}}

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(8)>DIV>H6" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(9)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPermanentResidence" CHARS="{{!col12}}"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(10)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantWorkPosition" CHARS="{{!col15}}, {{!col14}}"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(11)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPhoneNumber" CHARS="{{!col13}}"

EVENT TYPE=CLICK SELECTOR="HTML>BODY>APP-ROOT>APP-APPLICATION>SECTION>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(12)>DIV>LABEL" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#applicantPreliminaryPlaceResidence" CHARS="Roundtrip"
OK, glad I could help...! :D

A bit surprised about '!TIMEOUT_STEP' and 'TAG POS=0', but I use some older Version for most of my "Prod" Scripts (v8.8.2 for FF) and all my Scripts are automatically optimized and tuned for Speed and Reliability (5000-8000 Lines each), and some even auto-tune themselves depending on my Connection or the Web-Server Speed...

Yep, the 'EVENT' Mode is very powerful indeed... I see that you are on the FF ESR Channel, try to stay "as long as you can" up to or below FF56(-) (+ v8.9.7) as if you ever update FF to FF57(+), you'll have to update iMacros for FF as well to v10.0.2(+) which doesn't support the 'EVENT' Mode anymore/yet(?), which is a pity... :!:
- (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