XPATH QUERY
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
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
-
- Posts: 11
- Joined: Tue Jul 02, 2013 11:48 am
XPATH QUERY
Firefox 52.2.1 (32-bit)
Imacros VERSION BUILD=9030808
Windows XPsp2
They changed the page on me and XPATH is a bit obtuse for an old man like me
I now get the product code and product price extract twice
My code (courtesy of others who have helped previously)
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[1]" Extract=Txt <== This ends up with 553919553919
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[2]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[3]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[4]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[5]" Extract=Txt <== this ends up with $98.60$98.60
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[6]" Extract=Txt
SAVEAS TYPE=EXTRACT FOLDER=F:\PC-Stuff\Sendmail\DanPages FILE=ALM_EXT.CSV
SAMPLE TR DATA
<tr bgcolor='#ECECFF'>
<td><a href="javascript:launchWindow('History?ProductId=553919');" title="CRWN SEAL 750ML" class="phtip">553919</a> <input type="hidden"
name="ProductId" value="553919"/></td>
<td>CRWN SEAL MOSC 750ML</td>
<td align="center">6</td>
<td align="center">6</td>
<td align="right">$ 98.60<input type="hidden" name="UniversalDealIncGST" value="0.00" /></td>
<td align="center"><a title="No Current Allowance" class="alwtip">$ 0</a></td>
<td align="center"><font face="courier new" size="3"><tt><b> </b></tt></font><input type="text" name="OrderCtnQty" value=""
class="formfield" onfocus="resetKeepAliveTime();" maxlength="3" size="5"/></td>
<td align="center"><input type="hidden" name="OrderUnitQty" value=""/> </td>
<td><a href="javascript:launchWindow('/alm/user/LineCalculator?ProductId=553919&PackQty=6&WetRate=29.0&
BaseCostPriceExGST=69.49','popup',600,400);" title="View Line Calculator" class="tip"><img src="media/images/icons/inner_calculator.gif"
align="absmiddle" border="0" hspace="1" null></a> <input type="hidden" name="UnitPriceExGST" value="98.60"/></td>
<td align="center"><INPUT type="hidden" name="IsAddProduct" value="false"><input type="checkbox" name="IsAddProduct"/></td>
</tr>
Imacros VERSION BUILD=9030808
Windows XPsp2
They changed the page on me and XPATH is a bit obtuse for an old man like me
I now get the product code and product price extract twice
My code (courtesy of others who have helped previously)
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[1]" Extract=Txt <== This ends up with 553919553919
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[2]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[3]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[4]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[5]" Extract=Txt <== this ends up with $98.60$98.60
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[6]" Extract=Txt
SAVEAS TYPE=EXTRACT FOLDER=F:\PC-Stuff\Sendmail\DanPages FILE=ALM_EXT.CSV
SAMPLE TR DATA
<tr bgcolor='#ECECFF'>
<td><a href="javascript:launchWindow('History?ProductId=553919');" title="CRWN SEAL 750ML" class="phtip">553919</a> <input type="hidden"
name="ProductId" value="553919"/></td>
<td>CRWN SEAL MOSC 750ML</td>
<td align="center">6</td>
<td align="center">6</td>
<td align="right">$ 98.60<input type="hidden" name="UniversalDealIncGST" value="0.00" /></td>
<td align="center"><a title="No Current Allowance" class="alwtip">$ 0</a></td>
<td align="center"><font face="courier new" size="3"><tt><b> </b></tt></font><input type="text" name="OrderCtnQty" value=""
class="formfield" onfocus="resetKeepAliveTime();" maxlength="3" size="5"/></td>
<td align="center"><input type="hidden" name="OrderUnitQty" value=""/> </td>
<td><a href="javascript:launchWindow('/alm/user/LineCalculator?ProductId=553919&PackQty=6&WetRate=29.0&
BaseCostPriceExGST=69.49','popup',600,400);" title="View Line Calculator" class="tip"><img src="media/images/icons/inner_calculator.gif"
align="absmiddle" border="0" hspace="1" null></a> <input type="hidden" name="UnitPriceExGST" value="98.60"/></td>
<td align="center"><INPUT type="hidden" name="IsAddProduct" value="false"><input type="checkbox" name="IsAddProduct"/></td>
</tr>
Re: XPATH QUERY
Maybe the input elements cause troubles. What about this way?
or
and
If it doesn't work then you should use the EVAL command.
Code: Select all
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[1]/a" Extract=Txt
Code: Select all
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[1]/input" Extract=Txt
Code: Select all
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[5]/input" Extract=Txt
-
- Posts: 11
- Joined: Tue Jul 02, 2013 11:48 am
Re: XPATH QUERY
Thanks
both /a or /input work for the first cell however in the interim they changed the page slightly
and the 5th element now contains a <nobr>
However whilst the following works when these is no BOLD element it does not work when there is a BOLD
(The BOLD is only present when a product is onl special, the NOBR is always present)
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[5]/nobr" Extract=Txt
<td align="right"><b><nobr> $ 53.37 </nobr></b><input type="hidden" name="UniversalDealIncGST" value="0.00" /></td>
<td align="right"><nobr> $ 53.37 </nobr><input type="hidden" name="UniversalDealIncGST" value="0.00" /> </td>
GregF
both /a or /input work for the first cell however in the interim they changed the page slightly
and the 5th element now contains a <nobr>
However whilst the following works when these is no BOLD element it does not work when there is a BOLD
(The BOLD is only present when a product is onl special, the NOBR is always present)
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[5]/nobr" Extract=Txt
<td align="right"><b><nobr> $ 53.37 </nobr></b><input type="hidden" name="UniversalDealIncGST" value="0.00" /></td>
<td align="right"><nobr> $ 53.37 </nobr><input type="hidden" name="UniversalDealIncGST" value="0.00" /> </td>
GregF
-
- Posts: 11
- Joined: Tue Jul 02, 2013 11:48 am
Re: XPATH QUERY
My solution isn't elegant however the following does solve my problem
although it is probably going to break when they change things on me again
I do have the "safety" in knowing that change is not often because it is
not an e-commerce site it is just the wholesaler/retailer ordering
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0
set !LOOP 1
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[1]/a" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[2]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[3]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[4]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[5]/b[1]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[5]/nobr[1]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[6]" Extract=Txt
I would still like to know however why the NOBR fails when there is a <b><nobr> tag pair
surely the test is irrelevant to the precedence of the tags and indeed why the original
extracts the $$ amount twice (I know why the 1st tag did as it is there twice)
gregF
although it is probably going to break when they change things on me again
I do have the "safety" in knowing that change is not often because it is
not an e-commerce site it is just the wholesaler/retailer ordering
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0
set !LOOP 1
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[1]/a" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[2]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[3]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[4]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[5]/b[1]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[5]/nobr[1]" Extract=Txt
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[6]" Extract=Txt
I would still like to know however why the NOBR fails when there is a <b><nobr> tag pair
surely the test is irrelevant to the precedence of the tags and indeed why the original
extracts the $$ amount twice (I know why the 1st tag did as it is there twice)
gregF
Re: XPATH QUERY
Quoting all Posts in this Thread to be able to follow it a bit as it sounds a bit interesting, from @iimfun's Reply, but I guess it's not directly solved from the several Replies from @OP, that seems to belong to the in total 3 Users I've foed since I joined the Forum about 4 years ago (and started to help other Users...), but anyway I quote all Posts because I don't see them otherwise...
And hum, @OP mentioning their FCI directly (is nearly too perfect...!) , I guess my "pain-in-the-ass/foe" Thing probably comes from me asking @OP to mention their FCI at some time, and I guess it went awrok..., oops...!
But it looks a bit like the 'EVENT' Mode and if selecting/locating Cells in an HTML Table, Relative Positioning would do the same job and is much easier to use, I would think...
Maybe one day @OP will find the ']CODE[' Meta-Tags...!?
And hum, @OP mentioning their FCI directly (is nearly too perfect...!) , I guess my "pain-in-the-ass/foe" Thing probably comes from me asking @OP to mention their FCI at some time, and I guess it went awrok..., oops...!
footyfacts wrote:They changed the page on me and XPATH is a bit obtuse for an old man like meCode: Select all
Firefox 52.2.1 (32-bit) Imacros VERSION BUILD=9030808 Windows XPsp2
I now get the product code and product price extract twice
My code (courtesy of others who have helped previously)
SAMPLE TR DATACode: Select all
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[1]" Extract=Txt <== This ends up with 553919553919 Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[2]" Extract=Txt Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[3]" Extract=Txt Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[4]" Extract=Txt Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[5]" Extract=Txt <== this ends up with $98.60$98.60 Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[6]" Extract=Txt SAVEAS TYPE=EXTRACT FOLDER=F:\PC-Stuff\Sendmail\DanPages FILE=ALM_EXT.CSV
Code: Select all
<tr bgcolor='#ECECFF'> <td><a href="javascript:launchWindow('History?ProductId=553919');" title="CRWN SEAL 750ML" class="phtip">553919</a> <input type="hidden" name="ProductId" value="553919"/></td> <td>CRWN SEAL MOSC 750ML</td> <td align="center">6</td> <td align="center">6</td> <td align="right">$ 98.60<input type="hidden" name="UniversalDealIncGST" value="0.00" /></td> <td align="center"><a title="No Current Allowance" class="alwtip">$ 0</a></td> <td align="center"><font face="courier new" size="3"><tt><b> </b></tt></font><input type="text" name="OrderCtnQty" value="" class="formfield" onfocus="resetKeepAliveTime();" maxlength="3" size="5"/></td> <td align="center"><input type="hidden" name="OrderUnitQty" value=""/> </td> <td><a href="javascript:launchWindow('/alm/user/LineCalculator?ProductId=553919&PackQty=6&WetRate=29.0& BaseCostPriceExGST=69.49','popup',600,400);" title="View Line Calculator" class="tip"><img src="media/images/icons/inner_calculator.gif" align="absmiddle" border="0" hspace="1" null></a> <input type="hidden" name="UnitPriceExGST" value="98.60"/></td> <td align="center"><INPUT type="hidden" name="IsAddProduct" value="false"><input type="checkbox" name="IsAddProduct"/></td> </tr>
iimfun wrote:Maybe the input elements cause troubles. What about this way?orCode: Select all
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[1]/a" Extract=Txt
andCode: Select all
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[1]/input" Extract=Txt
If it doesn't work then you should use the EVAL command.Code: Select all
Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[5]/input" Extract=Txt
Arrgghh, but nope...,!, I thought it was the perfect try-and-fall/fail Thread to learn 'XPATH', but nope...!: URL not mentioned..., pity...!!footyfacts wrote:My solution isn't elegant however the following does solve my problem
although it is probably going to break when they change things on me again
I do have the "safety" in knowing that change is not often because it is
not an e-commerce site it is just the wholesaler/retailer ordering
I would still like to know however why the NOBR fails when there is a <b><nobr> tag pairCode: Select all
SET !ERRORIGNORE YES SET !TIMEOUT_STEP 0 set !LOOP 1 Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[1]/a" Extract=Txt Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[2]" Extract=Txt Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[3]" Extract=Txt Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[4]" Extract=Txt Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[5]/b[1]" Extract=Txt Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[5]/nobr[1]" Extract=Txt Tag XPath="//Tr[@bgcolor='#ECECFF'][{{!Loop}}]/Td[6]" Extract=Txt
surely the test is irrelevant to the precedence of the tags and indeed why the original
extracts the $$ amount twice (I know why the 1st tag did as it is there twice)
gregF
But it looks a bit like the 'EVENT' Mode and if selecting/locating Cells in an HTML Table, Relative Positioning would do the same job and is much easier to use, I would think...
Maybe one day @OP will find the ']CODE[' Meta-Tags...!?
- (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...
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
-
- Posts: 11
- Joined: Tue Jul 02, 2013 11:48 am
Re: XPATH QUERY
Pesky MetaTags ''
URL was not useful to problem and not posted as you have to login to the secure site
which is why I posted HTML snippets of data
Personally I think the final Code snippets for XPath are now quite useful for a Tyro
and could set many a beginner on their way
I am too cranky nowadays to bother having another comp language/markup in my brain
beyond the 200/300 in there now after 38 years of coding
GregF
Code: Select all
URL was not useful to problem and not posted as you have to login to the secure site
which is why I posted HTML snippets of data
Personally I think the final Code snippets for XPath are now quite useful for a Tyro
and could set many a beginner on their way
I am too cranky nowadays to bother having another comp language/markup in my brain
beyond the 200/300 in there now after 38 years of coding
GregF