- I will collect some here, and welcome anyone else to post some.
Code: Select all
;WBGet function - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=39869
q:: ;internet explorer - AHK forum logout
WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
oElt := oWB.document.querySelector(".nav-link[title=Logout]") ;class: nav-link, title: Logout
if IsObject(oElt)
oElt.click()
oWB := oElt := ""
return
;==================================================
w:: ;internet explorer - AHK forum - count elements
WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
oElts := oWB.document.querySelectorAll(".nav-link") ;class: nav-link
MsgBox, % oElts.length
oElts := oWB.document.querySelectorAll("[title=Logout]") ;title: Logout
MsgBox, % oElts.length
oElts := oWB.document.querySelectorAll(".nav-link[title=Logout]") ;class: nav-link, title: Logout
MsgBox, % oElts.length
;get tags/classes for elements
oElts := oWB.document.querySelectorAll("[title=Logout]") ;title: Logout
Loop, % oElts.length
{
MsgBox, % oElts[A_Index-1].tagName "`r`n" oElts[A_Index-1].className
}
;these are equivalent (first matching element):
;oElt := oWB.document.querySelector(vCriteria)
;oElt := oWB.document.querySelectorAll(vCriteria).0
MsgBox, % oWB.document.querySelector(".nav-link[title=Logout]").tagName
MsgBox, % oWB.document.querySelectorAll(".nav-link[title=Logout]").0.tagName
oWB := oElts := ""
return
;==================================================
[has a QUERYSELECTOR / QUERYSELECTORALL section]
jeeswg's Internet Explorer and HTML tutorial - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=31766
Internet Explorer: JavaScript examples - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=60377
- Links (specific examples):
shortest way to refer to a webpage element by tag/class/id - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=32436&p=151977#p151977
Internet Explorer: focus input field - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=59571&p=251483#p251483
Separate QuerySelectorAll Output Into Smaller Pieces, Inside a Loop - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=62724&p=267745#p267745