Difficult textbox entry

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
aelfwyne
Posts: 2
Joined: Wed Jan 26, 2022 7:59 pm

Difficult textbox entry

Post by aelfwyne » Wed Jan 26, 2022 8:25 pm

I am trying to input on a multi select container where you start typing and it autocompletes items that can be checked. I'm not sure what this type of container is called.

In normal use you can select from the list either by mouse, or by typing a partial search for the item you want, and hitting enter.

Unfortunately, it has been extremely troublesome. I have tried different recording modes, and different options. They seem to work sometimes, but not all the time. What appears to be happening is the box loses focus before the selection is finalized. If I am inputting manually this never happens. I have discovered that if I simplify the input to the fewest steps possible, it works better. But it still happens.

Code: Select all

<div class="chosen-container chosen-container-multi" style="width: 95%;" title="" id="districtstatement_chosen">
<ul class="chosen-choices"><li class="search-field"><input type="text" value="Select" class="default" autocomplete="off" style="width: 64px;">
</li>
</ul><div class="chosen-drop">
<ul class="chosen-results">
<li class="active-result" data-option-array-index="0" style="">This is the first sample item.</li>
<li class="active-result" data-option-array-index="1" style="">Here is a different sample item</li>
</ul></div></div>
Here is the current script I have - it is VERY simple because I'm trying to pare it down to only the needed parts (no fluff). Using event recording mode didn't work any better. In fact it was worse because it tried to track mouse clicks and the page may have a varying amount of content/position on screen so that won't work.

This version seems to work the best. The keypress marks the item which is currently the hilighted item based on the input, and checks that item in the box. However, it does not seem to do this with consistency - sometimes it works - sometimes it doesn't. If I do the same thing 'by hand' it works every time. If I watch the screen while the script runs, it appears the INPUT item disappears before it can be submitted.

Code: Select all

VERSION BUILD=1011 RECORDER=CR
TAG SELECTOR="#districtstatement_chosen>UL"
TAG SELECTOR="#districtstatement_chosen>UL>LI>INPUT" CONTENT=This<SP>is
EVENT TYPE=KEYDOWN SELECTOR="#districtstatement_chosen>UL>LI>INPUT" KEY=13
EVENT TYPE=KEYUP SELECTOR="#districtstatement_chosen>UL>LI>INPUT" KEY=13
I have tried other methods, event recording mode, element IDs on and off, CSS on and off.... Some work about the same as the above, some don't seem to work at all.

For example, it records this code with "Conventional" and "Css Selectors" which does absolutely nothing.

Code: Select all

VERSION BUILD=1011 RECORDER=CR
TAG SELECTOR="HTML>BODY>DIV:nth-of-type(2)>SECTION>DIV>SECTION>DIV>FIELDSET>DIV:nth-of-type(3)>DIV>DIV>UL"
TAG SELECTOR="HTML>BODY>DIV:nth-of-type(2)>SECTION>DIV>SECTION>DIV>FIELDSET>DIV:nth-of-type(3)>DIV>DIV>UL>LI>INPUT" CONTENT=This<SP>is
I'm not an iMacros expert, so I can't see what I'm missing. Any help?

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

Re: Difficult textbox entry

Post by chivracq » Thu Jan 27, 2022 1:26 pm

aelfwyne wrote:
Wed Jan 26, 2022 8:25 pm
I am trying to input on a multi select container where you start typing and it autocompletes items that can be checked. I'm not sure what this type of container is called.

In normal use you can select from the list either by mouse, or by typing a partial search for the item you want, and hitting enter.

Unfortunately, it has been extremely troublesome. I have tried different recording modes, and different options. They seem to work sometimes, but not all the time. What appears to be happening is the box loses focus before the selection is finalized. If I am inputting manually this never happens. I have discovered that if I simplify the input to the fewest steps possible, it works better. But it still happens.

Code: Select all

<div class="chosen-container chosen-container-multi" style="width: 95%;" title="" id="districtstatement_chosen">
<ul class="chosen-choices"><li class="search-field"><input type="text" value="Select" class="default" autocomplete="off" style="width: 64px;">
</li>
</ul><div class="chosen-drop">
<ul class="chosen-results">
<li class="active-result" data-option-array-index="0" style="">This is the first sample item.</li>
<li class="active-result" data-option-array-index="1" style="">Here is a different sample item</li>
</ul></div></div>
Here is the current script I have - it is VERY simple because I'm trying to pare it down to only the needed parts (no fluff). Using event recording mode didn't work any better. In fact it was worse because it tried to track mouse clicks and the page may have a varying amount of content/position on screen so that won't work.

This version seems to work the best. The keypress marks the item which is currently the hilighted item based on the input, and checks that item in the box. However, it does not seem to do this with consistency - sometimes it works - sometimes it doesn't. If I do the same thing 'by hand' it works every time. If I watch the screen while the script runs, it appears the INPUT item disappears before it can be submitted.

Code: Select all

VERSION BUILD=1011 RECORDER=CR
TAG SELECTOR="#districtstatement_chosen>UL"
TAG SELECTOR="#districtstatement_chosen>UL>LI>INPUT" CONTENT=This<SP>is
EVENT TYPE=KEYDOWN SELECTOR="#districtstatement_chosen>UL>LI>INPUT" KEY=13
EVENT TYPE=KEYUP SELECTOR="#districtstatement_chosen>UL>LI>INPUT" KEY=13
I have tried other methods, event recording mode, element IDs on and off, CSS on and off.... Some work about the same as the above, some don't seem to work at all.

For example, it records this code with "Conventional" and "Css Selectors" which does absolutely nothing.

Code: Select all

VERSION BUILD=1011 RECORDER=CR
TAG SELECTOR="HTML>BODY>DIV:nth-of-type(2)>SECTION>DIV>SECTION>DIV>FIELDSET>DIV:nth-of-type(3)>DIV>DIV>UL"
TAG SELECTOR="HTML>BODY>DIV:nth-of-type(2)>SECTION>DIV>SECTION>DIV>FIELDSET>DIV:nth-of-type(3)>DIV>DIV>UL>LI>INPUT" CONTENT=This<SP>is
I'm not an iMacros expert, so I can't see what I'm missing. Any help?

Thanks.

(F)CIM...! :mrgreen: (Read my Sig...)
=> FCI...?:

Code: Select all

iMacros for CR v10.1.1, 'Free'/'PE'/'Trial'...?, CR97/98...?, OS...?
... And edit your OP to add that (Required) Info, preferably at the very Top of your Post...

Always a "good Idea" to read the Forum Rules when you join a Tech Forum, ah-ah...!, => mention your FCI for me to have a look/do any "Thinking", but hum..., from a "quick look", it looks to me like you took the "right Approach" and already did the "correct Troubleshooting", can you share the URL of the Site/Page if that Site is "public"...?, or I'm "not sure" I'll be able to help you any further if I can't "play" with the Page myself... :twisted: :P :idea:

And your Thread has probably nothing specific to the 'iMacros for CR' Sub-Forum, I'll move it to the 'General' one... :|
... Done...: Thread moved... 8)
- (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...
aelfwyne
Posts: 2
Joined: Wed Jan 26, 2022 7:59 pm

Re: Difficult textbox entry

Post by aelfwyne » Thu Jan 27, 2022 5:41 pm

My apologies for as a new user being unaware of the intricacies of "posting correctly" on an official support forum.

I do have the trial version, and honestly, if I can't make it work for something this basic, not motivated to purchase it. It is on Chrome, so I assumed iMacros for Chrome was correct. Still don't quite understand from your message why that was wrong... Or what exactly you wanted for FCI or Troubleshooting.

And finally it's not a public page. It's proprietary database where I have to update thousands of records by hand and was hoping to automate the process a bit. Since it's private I quoted the relevant section of code here.

I was hoping someone would be less focused on "debugging" my mistakes, and know what the correct method to deal with that type of list would be.

Thank you for all the help you have provided.
Goodbye.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Difficult textbox entry

Post by chivracq » Thu Jan 27, 2022 6:45 pm

aelfwyne wrote:
Thu Jan 27, 2022 5:41 pm
My apologies for as a new user being unaware of the intricacies of "posting correctly" on an official support forum.

I do have the trial version, and honestly, if I can't make it work for something this basic, not motivated to purchase it. It is on Chrome, so I assumed iMacros for Chrome was correct. Still don't quite understand from your message why that was wrong... Or what exactly you wanted for FCI or Troubleshooting.

And finally it's not a public page. It's proprietary database where I have to update thousands of records by hand and was hoping to automate the process a bit. Since it's private I quoted the relevant section of code here.

I was hoping someone would be less focused on "debugging" my mistakes, and know what the correct method to deal with that type of list would be.

Thank you for all the help you have provided.
Goodbye.

Oh...!?, hum..., Okay..., that's not a "very good start", "funny" how most Users who can't spend 30 Sec to read the Forum Rules and can't mention 3 Versions about their Environment (like expected/required on all Tech Forums on Internet) often have a "short temper", ah-ah...! :o

Pity I hurt your "Feelings", I actually gave you a Compliment (on the Quality of your Post, well except about "FCI missing", of course, ah-ah...! :wink: ) with my "it looks to me like you took the "right Approach" and already did the "correct Troubleshooting"..."... But..., OK, can't please everybody in Life, ah-ah...! :P

Then well, "official support forum", the Forum is mostly (Advanced) Users helping Users, and "we" don't care about any License you might buy, but "we" need to know the 3 Versions about your FCI to be able to help you, simple...! Many Commands are not supported in all Versions/Browsers/OS'es, or get broken from some specific Version... :idea:

>>>

Then OK, I read your OP, and my "Advice" if you still want to hear it, ah-ah...! :wink: , would be to use the 'EVENT' Mode also to type (the beginning of) your Search Term(s), as the 'EVENT' Mode is a "slow" (Typing) Mode, then the DDLB has "the time" to start retrieving the Results, hum unless the Search gets only started upon hitting the 'Enter' Key still from the 'INPUT' Field, but in all cases with some mini-`WAIT` Statements (=0.2/0.5 Sec) between all Statements (or use the `!PLAYBACKDELAY` Command for that Section of Code), + also still use the 'EVENT' Mode to select the 1st Entry/Result in the DDLB, but with the 'Arrow_Down' Key, and "hopefully" the Entry/Result you'll want to select will always be the only or at least the 1st Entry, if your Search Keyword was "long enough"...

The mini-`WAIT` Statements are "important", and could explain why your Actions work "manually" but not from iMacros, as iMacros only needs a few Milliseconds between all Lines/Statements, while your manual Actions (with the Mouse or even Keyboard) will always be much slower, and the DDLB probably doesn't have the time to get populated while the 'UL'/'LI' Container for the Results is probably already constructed..., (and found by iMacros, or it would retry 6 times every 1 sec), ... but empty...
- (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