Automating Autocomplete Forms

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
kev36663
Posts: 2
Joined: Tue Jul 18, 2017 3:05 pm

Automating Autocomplete Forms

Post by kev36663 » Tue Jul 18, 2017 3:22 pm

iMarcos version (x64) 11.5.499.3066
intenet explorer 11.0.9600.18738
Windows 7 Professional - Service Pack 1


Hello everyone... I'm new to iMacros but have been making good progress the last couple of days since starting to use it.
It's been my first experience of testing using automation : I've managed to fill ordinary fields, select from dropdown, plus reading values from .csv
So, quite a lot of progress

I'm having problems with autocomplete fields. That's in where instead of being a dropdown, you start typing and it brings up suggestions and then you click one.

(One for example is an occupation field, of which there are about 1500 values stored. Another is field for motoring convictions)

When recording and playing back it's not populating properly.

So, when I recorded I typed in "Consultant" and then selected "Business Consultant" from the dropdown list

The code as it appears in iMacros Editor reads

TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:occupationSearch CONTENT=BUSINESS<SP>CONSULTANT
TAG POS=1 TYPE=LI ATTR=ID:ui-id-2

When I try to play back I receive the error
Error -1300: Cannot find HTML element of type "LI:" with attribute(s) "ID:ui-id-2".. Line 38: TAG POS=1 TYPE=LI ATTR=ID:ui-id-2

If I try to remove that line, then the completed form reads "Business Consultant" but it hasn't been selected from the list, so, when the playback tries to hit "next" it believes a value has not been selected.

Are there any suggestions on how I can automate this part of the process? Any advice appreciate.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Automating Autocomplete Forms

Post by chivracq » Tue Jul 18, 2017 4:04 pm

kev36663 wrote:

Code: Select all

iMarcos version (x64) 11.5.499.3066
intenet explorer 11.0.9600.18738
Windows 7 Professional - Service Pack 1
Hello everyone... I'm new to iMacros but have been making good progress the last couple of days since starting to use it.
It's been my first experience of testing using automation : I've managed to fill ordinary fields, select from dropdown, plus reading values from .csv
So, quite a lot of progress

I'm having problems with autocomplete fields. That's in where instead of being a dropdown, you start typing and it brings up suggestions and then you click one.

(One for example is an occupation field, of which there are about 1500 values stored. Another is field for motoring convictions)

When recording and playing back it's not populating properly.

So, when I recorded I typed in "Consultant" and then selected "Business Consultant" from the dropdown list

The code as it appears in iMacros Editor reads

Code: Select all

TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:occupationSearch CONTENT=BUSINESS<SP>CONSULTANT
TAG POS=1 TYPE=LI ATTR=ID:ui-id-2
When I try to play back I receive the error

Code: Select all

Error -1300: Cannot find HTML element of type "LI:" with attribute(s) "ID:ui-id-2".. Line 38: TAG POS=1 TYPE=LI ATTR=ID:ui-id-2
If I try to remove that line, then the completed form reads "Business Consultant" but it hasn't been selected from the list, so, when the playback tries to hit "next" it believes a value has not been selected.

Are there any suggestions on how I can automate this part of the process? Any advice appreciate.
Try using the 'EVENT' Mode which is usually able to better handle those dynamically populated DDLB's than the 'TAG' Mode...
And a mini-'WAIT' between the 2 Statements might help as well...
And make sure your '!TIMEOUT_STEP' is long enough (>=2) to allow the DDLB to retrieve its Content...

I can have a look if you can post the URL, if you don't come out by yourself...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
kev36663
Posts: 2
Joined: Tue Jul 18, 2017 3:05 pm

Re: Automating Autocomplete Forms

Post by kev36663 » Wed Jul 19, 2017 12:12 pm

Thanks,

I've tried again when recording as event
It does retrieve the drop down list, but won't select

Returns error of Error -1300: Cannot find HTML element using specified Selector expression: #ui-id-15. Line 28: EVENT TYPE=CLICK SELECTOR="#ui-id-15" BUTTON=0

The code reads as :
EVENT TYPE=CLICK SELECTOR="#occupationSearch" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#occupationSearch" CHARS="accou"
wait seconds = 2
EVENT TYPE=CLICK SELECTOR="#ui-id-15" BUTTON=0


I'm using a test platform
But the live website works in the same way : https://www.motorinsurance.collingwood.co.uk/

Basically getting a quote, it's on the second page of the application (although a similar one on the third page)

Using the 'event' recording, on playback it won't click the button next to the car registration (page 1) or post code (page 2) - these work on the 'TAG' setting - is it possible to mix and match?!
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Automating Autocomplete Forms

Post by chivracq » Wed Jul 19, 2017 6:15 pm

kev36663 wrote:Thanks,

I've tried again when recording as event
It does retrieve the drop down list, but won't select

Returns error of

Code: Select all

Error -1300: Cannot find HTML element using specified Selector expression: #ui-id-15. Line 28: EVENT TYPE=CLICK SELECTOR="#ui-id-15" BUTTON=0
The code reads as :

Code: Select all

EVENT TYPE=CLICK SELECTOR="#occupationSearch" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#occupationSearch" CHARS="accou"
wait seconds = 2
EVENT TYPE=CLICK SELECTOR="#ui-id-15" BUTTON=0

I'm using a test platform
But the live website works in the same way : https://www.motorinsurance.collingwood.co.uk/

Basically getting a quote, it's on the second page of the application (although a similar one on the third page)

Using the 'event' recording, on playback it won't click the button next to the car registration (page 1) or post code (page 2) - these work on the 'TAG' setting - is it possible to mix and match?!
Ah OK, I didn't want to mention it in my first Reply because "ui-id-2" looked "legit" but the ID is dynamic as you can see it now becomes "ui-id-15", and even "ui-id-70" for me when I check the Page.
Was a bit of a hassle to reach Page_2 about "Policyholder Details" as Page_1 needed some valid UK Registration Number + a valid Postcode, but OK, I managed...:
+ Registration Nb: "EBZ 5155"
+ Postcode: "BR1 1AA"

You then need to replace the changing part in the ID with a Wildcard like for example if you want to select "Accountant":

Code: Select all

VERSION BUILD=8820413 RECORDER=FX
TAB T=1
'URL GOTO=https://www.motorinsurance.collingwood.co.uk/Customer/Index

TAG POS=1 TYPE=LABEL FORM=ACTION:/Customer/Save ATTR=TXT:Occupation
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/Customer/Save ATTR=ID:occupationSearch CONTENT=accou
'Select "Accountant":
'TAG POS=1 TYPE=LI ATTR=ID:ui-id-70 // (Recorded)
TAG POS=R2 TYPE=LI ATTR=ID:ui-id-*
But this one works as well directly for me:

Code: Select all

TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/Customer/Save ATTR=ID:occupationSearch CONTENT=ACCOUNTANT
If you want to use the 'EVENT' Mode, it works as well if you select the 'EVENT' Mode without ID's:

Code: Select all

VERSION BUILD=8820413 RECORDER=FX
TAB T=1
'URL GOTO=https://www.motorinsurance.collingwood.co.uk/Customer/Index

'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV>FORM>DIV>DIV>DIV:nth-of-type(8)>LABEL" BUTTON=0
'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV>FORM>DIV>DIV>DIV:nth-of-type(8)>DIV>INPUT" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>DIV>FORM>DIV>DIV>DIV:nth-of-type(8)>DIV>INPUT" CHARS="accou"
'Select "Accountant":
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV>FORM>DIV>DIV>DIV:nth-of-type(8)>DIV>UL>LI:nth-of-type(2)" BUTTON=0
(Tested on iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10-x64.)

And yep, you can mix all Modes together in the same Script.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Post Reply