Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pvillamil/00bebd38d5e5809bfda51cc792287980 to your computer and use it in GitHub Desktop.
Save pvillamil/00bebd38d5e5809bfda51cc792287980 to your computer and use it in GitHub Desktop.
#SingleInstance, force
#Include, lib\Chrome\Chrome.ahk ;https://github.com/G33kDude/Chrome.ahk/releases
; verify if the profile folder exists
; if not, create it
if !FileExist("profile")
FileCreateDir, % "profile"
; load the chrome object pointing to the folder created above
; and the link to the page (or pages) to open at startup
chrome := new chrome("profile", "https://www.the-automator.com/autohotkey/chrome-with-autohotkey/")
; get the first page (you can use other functions to select a specific page, like GetPageByTitle() or GetPageByURL())
pg := chrome.getpage()
; wait for the page to finish loading before clicking anything.
; clicking on an nonexistant element results in an error
pg.WaitForLoad("complete")
; pass arbitrary javascript to the page. This allows you to do virtually anything you want
; with the page
pg.Evaluate("document.querySelectorAll('#post-4101 > div > p:nth-child(4) > a:nth-child(4)')[0].click()")
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment