MuslimPerson wrote:HI chivracq , firstly thanks for your replys ..
we don't care (and don't want to care) about your religious
i think you don't know the islam religion to say this , whatever the "Allah bless you" in the last of my comments are like = best regards , hope you in best case , etc ..
and there is no wrong thing in it , i don't talk about religions here , it's just simple words like i explained ..
whatever , it's not our subject ..
No comments...
MuslimPerson wrote:i want to : "EXTRACT THE POSITION OF (repaeated) ELEMENT ("same" in some attributes (like "class" in our example))"
Example:
Code: Select all
<div class="class1">Text1</div>
<div class="class1">Text2</div>
<div class="class1">Text3</div>
<div class="class1">Text4</div>
<div class="class1">Text5</div> //i found this element by text , i want to know (Programmatically with imacros) the POSITION of this element (according to same elements (Similar in some attributes (like class in this case)))
<div class="class1">Text6</div>
<div class="class1">Text7</div>
<div class="class1">Text8</div>
<div class="class1">Text9</div>
<div class="class1">Text10</div>
OK, so your Starting Point is "Text5", from which you can deduct "class1" if you don't know it already, using 'EXTRACT=HTM' + 'EVAL()'.
Then you need to do an 'EXTRACT=HTM' on the 'DIV' at a higher Level containing all your 'DIV's with "class1", using its Class for example directly if you already know it.
If you don't know it or don't know any Attributes to identify and tag that Containing 'DIV' directly, you will need to use "Double Relative Positioning" to tag some non-'DIV' HTML Element outside of the Containing 'DIV' (before or after it, it doesn't matter, whatever Element is easier to locate and more likely to be Unique), to then be able for iMacros to see and tag that Containing 'DIV'. (Search my Posts on "Double Relative Positioning" if you don't understand or want more Info about the Principe and find Code Examples...)
Once you've got the 'EXTRACT=HTM' Data on the Containing 'DIV', you use 'EVAL()' + 'match()' or 'split()' to find your Position Nb...!
I don't like/use/know 'match()' so I'll elaborate on using 'split()', but pfff..., would be easier if you had posted the URL of your Page...
=> First, 'split()' on "Text5" will return 2 Strings, z[0] and z[1]. ('split()' returns an Array...)
=> Then, 'split()' on "class1" applied to 'z[0]' and the 'length()' Property (-1) of the Array returned by the 'split()' will give you your Pos_Nb.
This is one Solution, there are probably other ways...
Have a look at the following Thread where I applied/demonstrated this "Technique" on a DDLB to find out dynamically the Total Nb of Options in the DDLB. The Principle is the same...
-
Re: Number of Options in a Select tag
The DDLB would be your Containing 'DIV' and the DDLB Options would be your 'class1' Elements.
Enjoy...! (And post your Final Script once you got it to work..., and/or if you get stuck somewhere...)
- (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...