iMacros如何在没有元素属性的情况下提取数据?

时间:2016-07-25 14:43:18

标签: extract imacros text-extraction

我想获取提取数据:姓名,电子邮件,电话,日期,城市
这里是HTML示例代码:

<tbody>
    <tr class="grid-row">
            <td>Jimmy Shark</td>
            <td>jshark@gmail.com</td>
            <td>082166883333</td>
            <td>07/13/15, 07:23 AM</td>
            <td></td>
        </tr>
    <tr class="odd grid-row">
            <td>Denny Large</td>
            <td>large.denny@gmail.com</td>
            <td>08575510121</td>
            <td>07/09/16, 11:55 PM</td>
            <td></td>
    </tr>
    <more and repeated>
</tbody>

1 个答案:

答案 0 :(得分:0)

从以下宏开始并更正以符合您的目标:

SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0
SET !EXTRACT_TEST_POPUP NO

TAG XPATH="//tr[@class='grid-row'][{{!LOOP}}]/td[1]" EXTRACT=TXT
TAG XPATH="//tr[@class='grid-row'][{{!LOOP}}]/td[2]" EXTRACT=TXT
TAG XPATH="//tr[@class='grid-row'][{{!LOOP}}]/td[3]" EXTRACT=TXT
TAG XPATH="//tr[@class='grid-row'][{{!LOOP}}]/td[4]" EXTRACT=TXT
TAG XPATH="//tr[@class='grid-row'][{{!LOOP}}]/td[5]" EXTRACT=TXT
PROMPT {{!EXTRACT}}
SET !EXTRACT NULL

TAG XPATH="//tr[@class='odd grid-row'][{{!LOOP}}]/td[1]" EXTRACT=TXT
TAG XPATH="//tr[@class='odd grid-row'][{{!LOOP}}]/td[2]" EXTRACT=TXT
TAG XPATH="//tr[@class='odd grid-row'][{{!LOOP}}]/td[3]" EXTRACT=TXT
TAG XPATH="//tr[@class='odd grid-row'][{{!LOOP}}]/td[4]" EXTRACT=TXT
TAG XPATH="//tr[@class='odd grid-row'][{{!LOOP}}]/td[5]" EXTRACT=TXT
PROMPT {{!EXTRACT}}