使用iMacros在" a"中使用标题点击JavaScript链接with document.querySelector()?

时间:2018-04-03 23:31:12

标签: javascript dom href imacros

我需要点击"保存更改"链接我的iMacros脚本,但不知怎的,我无法。这是链接及其周围的HTML代码:

    <span id="ctl09_ctl00_avbSavePropertySettings">
            <table Title="" class="printhide" cellpadding="0" cellspacing="0" border="0" 
            onmouseover="self.status=&#39;Save the changes to the property.&#39;;return true;" 
            onmouseout="self.status=&#39;&#39;;return true;">
            <tr><td class="AvidButton-left" width="12" height="17" rowspan="3"></td>
            <td class="AvidButton-top" height="3"></td>
            <td class="AvidButton-right" width="7" height="17" rowspan="3"></td></tr>
            <tr>
            <td nowrap="nowrap" class="AvidButton-text" height="11">
        <a onclick="return propertyClass.save(this);" title="Save Changes" 
        href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions
       (&quot;ctl09$ctl00$avbSavePropertySettings$ctl07&quot;, 
        &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))">Save Changes</a></td>
            </tr>
            <tr><td class="AvidButton-bottom" height="3"></td></tr>
            </table>
            </span>

当我尝试使用Chrome开发者工具时,这是有用的:

document.querySelector("a[title='Save Changes']").click();

但是当我尝试在我的iMacros代码中使用它时,它不起作用:

URL GOTO=javascript:document.querySelector("a[title='Save Changes']").click();

以下是我尝试的其他一些命令:

TAG SELECTOR="#ctl09_ctl00_avbSavePropertySettings>TABLE>TBODY>TR:nth-of-type(2)>TD>A"

TAG XPATH="./a[contains(.,'Save Changes')]

TAG SELECTOR="#ctl09_ctl00_avbSavePropertySettings>TABLE>TBODY>TR:nth-of-type(2)>TD>A"

TAG POS=1 TYPE=A ATTR=TXT:Save<SP>Changes

TAG XPATH="//*[@id="ctl09_ctl00_avbSavePropertySettings"]/table/tbody/tr[2]/td/a"

TAG XPATH="//*[@id="ctl09_ctl00_avbSavePropertySettings"]/table/tbody/tr[2]/td/a"

EVENT TYPE=CLICK XPATH="//*[@id="ctl09_ctl00_avbSavePropertySettings"]/table/tbody/tr[2]/td/a"

TAG POS=1 TYPE=A ATTR=TITLE:"Save Changes"

欢迎任何建议 - 我已经花了很长时间在这上面了!

非常感谢!

1 个答案:

答案 0 :(得分:0)

以下代码行可能会对您有所帮助:

filter1 <- data$strip1 >= threshold_strip1[data$strip1]
filter2 <- data$strip2 >= threshold_strip1[data$strip2]

data <- subset(data, filter1 & filter2)

你也可以试试这个:

EVENT TYPE=CLICK SELECTOR="a[title='Save Changes']"