Thanks for that, that works well. Do you know where I can find similar commands documented or at least listed by someone.
And while I'm here I have only seen error handling in a very very few places so here is an example that others may find in future:
Code: Select all
ChromeInst := new Chrome(ProfilePath:=DirFS) ;As far as I can see relative paths aren't supported (doco wrong?) and slashes have to be forward ones
PageInstance := ChromeInst.GetPageBy("url", NaaPageUrlStartsWith, "startswith")
if IsObject(PageInstance)
{
;--- bring the existing tab/page into focus
PageInstance.Call("Page.bringToFront") ;Thanks gregster :=)
}
else
{
;--- It doesn't exist so open the URL and wait for the page to load ---
PageInstance := ChromeInst.GetPage()
PageInstance.Call("Page.navigate", {"url": NaaSearchUrl})
;SoundBeep, 1050, 200
PageInstance.WaitForLoad()
Sleep 500
}
...
try
{
;--- WORKS IF AT: "https://recordsearch.naa.gov.au/SearchNRetrieve/Interface/SessionTimeout.aspx"
PageInstance.Evaluate("document.getElementById('ContentPlaceHolderSNR_lbnGuest').click()")
PageInstance := ChromeInst.GetPage()
PageInstance.WaitForLoad()
Sleep 500
}
catch e
{}