简体   繁体   English

使用iMacros在JavaScript链接上使用带有document.querySelector()的“ a”中的标题?

[英]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=&#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>

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.

相关问题 在 document.queryselector 中使用变量 - using a variable in document.queryselector 在 Storybook Vue 中使用 document.querySelector - Using document.querySelector in Storybook Vue 反应:将document.QuerySelector用作库的一部分 - React: Using document.QuerySelector as part of a library 使用document.querySelector和复杂的CSS选择器 - using document.querySelector with complex CSS selectors 使用 document.querySelector 应用样式 - Apply style using document.querySelector jQuery:has() 等效使用 document.querySelector - jQuery :has() equivalent using document.querySelector 在打开特定选项卡后使用 javascript:document.querySelector('#').click() 时如何向下滚动到特定选项卡内容 - How do i make a scrolldown to a specific tab content when using javascript:document.querySelector('#').click() after the specific tab is opened “document.querySelector(”“).click”不起作用 - “document.querySelector(”“).click” not working Chrome 扩展程序:使用 document.getSelection() 后无法使用 document.querySelector().click() - Chrome extension: cannot use `document.querySelector().click()` after using `document.getSelection()` 使用 document.querySelector() 触发事件 click() 不起作用,但从控制台触发 CSS 事件 click() 可以 - Triggering event click() using document.querySelector() is not working, but triggering CSS event click() from console works ok
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM