[英]Using iMacros to click on JavaScript link using the title in an “a” with document.querySelector()?
I need to click on the "Save Changes" link with my iMacros script but somehow I am unable to. 我需要使用iMacros脚本单击“保存更改”链接,但是以某种方式无法完成。 Here is the link and its surrounding HTML Code: 这是链接及其周围的HTML代码:
<span id="ctl09_ctl00_avbSavePropertySettings">
<table Title="" class="printhide" cellpadding="0" cellspacing="0" border="0"
onmouseover="self.status='Save the changes to the property.';return true;"
onmouseout="self.status='';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
("ctl09$ctl00$avbSavePropertySettings$ctl07",
"", true, "", "", false, true))">Save Changes</a></td>
</tr>
<tr><td class="AvidButton-bottom" height="3"></td></tr>
</table>
</span>
This has worked when I try the Chrome developer tools: 当我尝试使用Chrome开发人员工具时,此方法已奏效:
document.querySelector("a[title='Save Changes']").click();
But it doesn't work when i try to use this inside my iMacros code: 但是当我尝试在我的iMacros代码中使用它时,它不起作用:
URL GOTO=javascript:document.querySelector("a[title='Save Changes']").click();
Here are some of the other commands I have tried: 这是我尝试过的其他一些命令:
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"
Any advice is welcome - I have spent far too long on this already! 欢迎任何建议-我已经花了太长时间了!
Thanks so much! 非常感谢!
Perhaps the following line of code will be helpful to you: 以下代码行可能对您有所帮助:
EVENT TYPE=CLICK SELECTOR="a[title='Save Changes']"
You can also try this: 您也可以尝试以下操作:
URL GOTO=javascript:document.querySelector("a[title='Save<SP>Changes']").click();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.