简体   繁体   中英

Select <td> element using autohotkey

I am attempting to select a 'copy-to-clipboard' function within a website that is buried pretty deep within the DOM. As proof of concept, I'd like to have AutoHotKey .click() the anchor element, and then display it's contents in a MsgBox. From the javascript console in IE I can manipulate it just fine using the below code:

t = document.getElementById("id-value")
t.getElementsByTagName("td")[1].click()

These two lines do what I want it to do... when I place them within an AHK script, it just kind of hangs out... below you'll find my AHK script

#SingleInstance, Force
#Include, C:\Users\rspeight\Desktop\AHK_Scripts\IEFuncs.ahk    

IE("https://validURL", true)
sleep, 3000

t:= document.getElementByID("2752")
t.getElementByTagName("td")[1].click()

MsgBox, Did this work?

Return

any help would be greatly appreciated.

Below is what I did to make it work.

pwb := WBGet()

t:=pwb.document.getElementById("2752")
d:=t.getElementsByTagName("td")[1].click()
sleep, 2000
b:=pwb.document.getElementById("secretView_2752")
r:=b.getElementsByTagName("a")[3].click()

for some reason, I had to place the 'tagname' element into another variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM