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.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Automating Autocomplete Forms

by kev36663 on Tue Jul 18, 2017 8:22 am

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.
kev36663
 
Posts: 2
Joined: Tue Jul 18, 2017 8:05 am

Re: Automating Autocomplete Forms

by chivracq on Tue Jul 18, 2017 9:04 am

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)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: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Automating Autocomplete Forms

by kev36663 on Wed Jul 19, 2017 5:12 am

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?!
kev36663
 
Posts: 2
Joined: Tue Jul 18, 2017 8:05 am

Re: Automating Autocomplete Forms

by chivracq on Wed Jul 19, 2017 11:15 am

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)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: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to General Support & Discussions

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests

cron
-->