how to determine code if find duplicate element placeholder ??

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
anggun123
Posts: 55
Joined: Tue Aug 03, 2021 2:39 pm

how to determine code if find duplicate element placeholder ??

Post by anggun123 » Sat Oct 23, 2021 11:41 pm

Code: Select all

Browser Firefox 48.0
iMacros for Firefox 8.9.7
Windows 10 32-bit Operating system

Good morning

I want to input data into the website

but there is a double element placeholder?
any ideas?
1
1

this is my code

Code: Select all

SET !CLIPBOARD size
EVENTS TYPE=KEYPRESS SELECTOR="*[placeholder='Please type or select']" CHARS="V" MODIFIERS="ctrl"
I want to input these 2 columns
2
2
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: how to determine code if find duplicate element placeholder ??

Post by chivracq » Sun Oct 24, 2021 12:12 am

anggun123 wrote:
Sat Oct 23, 2021 11:41 pm

Code: Select all

Browser Firefox 48.0
iMacros for Firefox 8.9.7
Windows 10 32-bit Operating system

Good morning

I want to input data into the website

but there is a double element placeholder?
any ideas?

Screenshot_1.png


this is my code

Code: Select all

SET !CLIPBOARD size
EVENTS TYPE=KEYPRESS SELECTOR="*[placeholder='Please type or select']" CHARS="V" MODIFIERS="ctrl"
I want to input these 2 columns

Screenshot_2.png

Hum, Thread has nothing specific to the 'iMacros for FF' Sub-Forum, I'll move it to the 'General' one...

>>>

To answer your Qt/Scenario, => use the 'TAG' Mode with the 'FORM' Param which is possibly different for both Blocks, or that will trigger some "POS=1"/"POS=2" for each Input Field, or use 'Relative Positioning' still with the 'TAG' Mode, with "Variation1" and "Variation2" as 'Anchors'... :idea:

If you "really" need the 'EVENT' Mode and can't use the 'TAG' Mode, then uncheck in the Recording Options for the 'EVENT' Mode the "Try to use the Element ID" to force iMacros to use the full CSS Path, and you will "somewhere" in the SELECTOR PATH have ">DIV>" + ">DIV:nth-of-type(2)>" for both Input Elements, but also valid are ">DIV:nth-of-type(1)>" + ">DIV:nth-of-type(2)>", where you can use the "1"/"2" to differentiate both Elements, like you would do with "POS=1"/"POS=2"... :idea:
- (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...
anggun123
Posts: 55
Joined: Tue Aug 03, 2021 2:39 pm

Re: how to determine code if find duplicate element placeholder ??

Post by anggun123 » Sun Oct 24, 2021 1:49 am

okay
thanks :D
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: how to determine code if find duplicate element placeholder ??

Post by chivracq » Tue Oct 26, 2021 5:08 am

anggun123 wrote:
Sun Oct 24, 2021 1:49 am
okay
thanks :D

Yeah "okay + thanks", any chance you could be a bit more "communicative"...? :roll:
I mentioned 4 (possible) Solutions/Implementations, => which one did you go for...? :?

And post your adapted Script to show how you implemented your selected Solution/Implementation to make this Thread also "useful" for other Users..., grrr..., I shouldn't have to ask...! :idea:

>>>

"Just saying", but hum..., => I "hesitated" to help you again and to answer this Thread as you've only "provided" Low Quality for the Forum and the "iMacros Users Community" in your several last few Threads, but I would think you are now "screwing it a bit (for yourself)" and that was probably the last time I was helping you /answering one of your Threads/Qt's... (=> unless you post some "High/Good/OK Quality" final Post to this Thread with your working Script/Implementation... :idea: )

The Forum is not just a (personal) "Help Service", it is also meant to create a DataBase of Qt's/Scenarios and Solutions for other Users to search for..., and to reuse with little Adaptation for their Use... :idea:
- (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...
anggun123
Posts: 55
Joined: Tue Aug 03, 2021 2:39 pm

Re: how to determine code if find duplicate element placeholder ??

Post by anggun123 » Sat Nov 20, 2021 9:42 am

chivracq wrote:
Tue Oct 26, 2021 5:08 am
anggun123 wrote:
Sun Oct 24, 2021 1:49 am
okay
thanks :D

Yeah "okay + thanks", any chance you could be a bit more "communicative"...? :roll:
I mentioned 4 (possible) Solutions/Implementations, => which one did you go for...? :?

And post your adapted Script to show how you implemented your selected Solution/Implementation to make this Thread also "useful" for other Users..., grrr..., I shouldn't have to ask...! :idea:

>>>

"Just saying", but hum..., => I "hesitated" to help you again and to answer this Thread as you've only "provided" Low Quality for the Forum and the "iMacros Users Community" in your several last few Threads, but I would think you are now "screwing it a bit (for yourself)" and that was probably the last time I was helping you /answering one of your Threads/Qt's... (=> unless you post some "High/Good/OK Quality" final Post to this Thread with your working Script/Implementation... :idea: )

The Forum is not just a (personal) "Help Service", it is also meant to create a DataBase of Qt's/Scenarios and Solutions for other Users to search for..., and to reuse with little Adaptation for their Use... :idea:
Sorry for the late response
like your idea i used this code and it worked :

Code: Select all

for (s = 1; s <=10 ; s++) {
					iimSet("size",size[s]);	
					iimSet("dir",dir); 
					iimSet("s",s); 
					macro="CODE:";
					macro+='SET !REPLAYSPEED FAST' + "\n";
					macro+='SET !ERRORIGNORE YES' + "\n";
					macro+='SET !DATASOURCE {{dir}}" + "\n";
					macro+='SET !DATASOURCE_LINE {{i}}" + "\n";
					macro+="SET !CLIPBOARD {{size}}" + "\n";
					macro+="EVENTS TYPE=KEYPRESS SELECTOR=\"HTML>BODY>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type({{s}})>DIV>DIV>DIV>DIV>DIV>DIV>DIV>DIV>SPAN>SPAN>INPUT\" CHARS=\"V\" MODIFIERS=\"ctrl\"" + "\n";	
					macro+="EVENTS TYPE=KEYPRESS SELECTOR=\"HTML>BODY>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type({{s}})>DIV>DIV>DIV>DIV>DIV>DIV>DIV>DIV>SPAN>SPAN>INPUT\" KEYS=\"[37,13]\"" + "\n";	
					macro+="EVENT TYPE=CLICK SELECTOR=\"HTML>BODY>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>SPAN\" BUTTON=0" + "\n";
					iimPlay(macro);	
					}
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: how to determine code if find duplicate element placeholder ??

Post by chivracq » Sat Nov 20, 2021 10:28 pm

anggun123 wrote:
Sat Nov 20, 2021 9:42 am
Sorry for the late response
like your idea i used this code and it worked :

Code: Select all

for (s = 1; s <=10 ; s++) {
					iimSet("size",size[s]);	
					iimSet("dir",dir); 
					iimSet("s",s); 
					macro="CODE:";
					macro+='SET !REPLAYSPEED FAST' + "\n";
					macro+='SET !ERRORIGNORE YES' + "\n";
					macro+='SET !DATASOURCE {{dir}}" + "\n";
					macro+='SET !DATASOURCE_LINE {{i}}" + "\n";
					macro+="SET !CLIPBOARD {{size}}" + "\n";
					macro+="EVENTS TYPE=KEYPRESS SELECTOR=\"HTML>BODY>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type({{s}})>DIV>DIV>DIV>DIV>DIV>DIV>DIV>DIV>SPAN>SPAN>INPUT\" CHARS=\"V\" MODIFIERS=\"ctrl\"" + "\n";	
					macro+="EVENTS TYPE=KEYPRESS SELECTOR=\"HTML>BODY>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type({{s}})>DIV>DIV>DIV>DIV>DIV>DIV>DIV>DIV>SPAN>SPAN>INPUT\" KEYS=\"[37,13]\"" + "\n";	
					macro+="EVENT TYPE=CLICK SELECTOR=\"HTML>BODY>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>SPAN\" BUTTON=0" + "\n";
					iimPlay(macro);	
					}

Alright, very good...! And Thanks for sharing... :D

So you went for the `EVENT` Mode Implementation with ">DIV>DIV:nth-of-type({{s}})>DIV>" with s=[1-10]... OK, very neat...! :D

Also "very neat" is your Use of the OS Clipboard and the `!CLIPBOARD` Var in order to "quickly" paste the Content of some Var, also using the `EVENT` Mode with "Ctrl^v", to "work around" the "slow" Typing of the `EVENT` Mode... Perfect...! :D

+ 'Arrow Left' (Key=37) + 'Enter' (Key=13) to "avoid" the Focus on the pasted Content and the 'Enter' re-deleting that Content... Also very neat... I usually go for 'Arrow Right' or 'End', but I guess 'Arrow Left' also "does the job", at least on this Site...
- (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