[Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No IE!
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No Selenium!
I have the impression it is not related to redirecting internet explorer to edge, but with the latest Chrome update.
I have systems that are still working, with the redirecting of internet explorer to Edge.
I have systems that are still working, with the redirecting of internet explorer to Edge.
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No Selenium!
the problem is Chrome.
I downgraded it and the library came back to work.
I followed this tutorial:
https://browserhow.com/how-to-downgrade-and-install-older-version-of-chrome/
I downgraded it and the library came back to work.
I followed this tutorial:
https://browserhow.com/how-to-downgrade-and-install-older-version-of-chrome/
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No Selenium!
Run with "--remote-allow-origins=*" flag.
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No Selenium!
Thanks. I confirm that malcev's solution works for me. Example syntax with that flag
Chrome(ChromeProfile, "https://www.google.com", "--remote-allow-origins=*")
So like @AHK_user suggested it appears to be caused by some change in Chrome, not in Windows.
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No Selenium!
i also confirm this works, thanks @malcev and @neogna2 for elaboration!
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No Selenium!
Yes, it works:
It works:
But this one doesn't work like before:
What can be done to make it work again?
Code: Select all
ChromeInst := new Chrome(ChromeProfile, "https://www.google.com", "--remote-allow-origins=*")
Code: Select all
if (Chromes := Chrome.FindInstances())
ChromeInst := {"base": Chrome, "DebugPort": Chromes.MinIndex()} ; or if you know the port: ChromeInst := {"base": Chrome, "DebugPort": 9222}
URL := ChromeInst.GetPageList()[1].url
Title := ChromeInst.GetPageList()[1].Title
MsgBox URL: %URL%`nTitle: %Title%
Code: Select all
if (Chromes := Chrome.FindInstances())
ChromeInst := {"base": Chrome, "DebugPort": Chromes.MinIndex()} ; or if you know the port: ChromeInst := {"base": Chrome, "DebugPort": 9222}
if !(PageInst := ChromeInst.GetPage())
{
ChromeInst.Kill()
}
PageUrl := PageInst.Evaluate("document.URL;").Value
MsgBox PageUrl: %PageUrl%
-
- Posts: 35
- Joined: 23 Mar 2022, 22:10
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No Selenium!
@malcev
thank u, now it works again with 2 flags "--remote-debugging-port=9222 --remote-allow-origins=*"
thank u, now it works again with 2 flags "--remote-debugging-port=9222 --remote-allow-origins=*"
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No Selenium!
hello, since a few day authotkey does not working anymore with chrome.ahk, any script or simple test script quits with websocket error thrown in chrome.ahk:
any help ?
any help ?
Code: Select all
else if (EventName == "Error")
{
throw Exception("Websocket Error!")
}
Code: Select all
#Include ./lib/Chrome.ahk
; Create an instance of the Chrome class using
; the folder ChromeProfile to store the user profile
FileCreateDir, ChromeProfile
ChromeInst := new Chrome("ChromeProfile")
; Connect to the newly opened tab and navigate to another website
; Note: If your first action is to navigate away, it may be just as
; effective to provide the target URL when instantiating the Chrome class
PageInst := ChromeInst.GetPage()
PageInst.Call("Page.navigate", {"url": "https://autohotkey.com/"})
PageInst.WaitForLoad()
; Execute some JavaScript
PageInst.Evaluate("alert('Hello World!');")
; Close the browser (note: this closes *all* pages/tabs)
PageInst.Call("Browser.close")
PageInst.Disconnect()
ExitApp
return
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No Selenium!
tried --remote-allow-origins=* but do not work
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No Selenium!
@lassos
As for shortcut version for me works:
As for shortcut version for me works:
Code: Select all
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --remote-allow-origins=* --user-data-dir="D:\ahk_chrome_profile"
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No Selenium!
Thanks @malcev and @Gh0sTG0, finally everything works, including this code
Code: Select all
if (Chromes := Chrome.FindInstances())
ChromeInst := {"base": Chrome, "DebugPort": Chromes.MinIndex()} ; or if you know the port: ChromeInst := {"base": Chrome, "DebugPort": 9222}
if !(PageInst := ChromeInst.GetPage())
{
ChromeInst.Kill()
}
PageUrl := PageInst.Evaluate("document.URL;").Value
MsgBox PageUrl: %PageUrl%
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No Selenium!
Wow, thanks, this works for me too .-) , pretty cool, it is working again. spent so much time in my automating browser website routines with chrome.ahk. allready considered to develop chrome extension. now i do not needGh0sTG0 wrote: ↑14 Mar 2023, 15:53@lassos
As for shortcut version for me works:Code: Select all
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --remote-allow-origins=* --user-data-dir="D:\ahk_chrome_profile"
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No IE!
Chrome.ahk 1.3.0 has been released. It uses new websocket code, and new JSON code. Please test and review.
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No IE!
Not really, just aimed at performance and bug fixes. thqby has a V2 port which I've heard ok things about.
I don't really have much time to write AHK code anymore, between a full time job and expenses
Friendly reminder I do accept donations, up to date information will always be at the bottom of https://geekdude.io
I don't really have much time to write AHK code anymore, between a full time job and expenses
Friendly reminder I do accept donations, up to date information will always be at the bottom of https://geekdude.io
-
- Posts: 35
- Joined: 23 Mar 2022, 22:10
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No IE!
@geek
I downloaded the 1.3 source code (Zip) but it is missing websocket.ahk and cJson.ahk. I had to manually copy and paste those 2 files into a single chrome.ahk file
I downloaded the 1.3 source code (Zip) but it is missing websocket.ahk and cJson.ahk. I had to manually copy and paste those 2 files into a single chrome.ahk file
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No IE!
Go to github, there should be full filethaihoa3189 wrote: ↑22 Mar 2023, 04:59@geek
I downloaded the 1.3 source code but it is missing websocket.ahk and cJson.ahk. I had to manually copy and paste those 2 files into a single chrome.ahk file
( in 1st post there is Releases link )
-
- Posts: 35
- Joined: 23 Mar 2022, 22:10
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No IE!
@Gh0sTG0
I saw it. Thank you
I saw it. Thank you
-
- Posts: 1
- Joined: 06 Apr 2023, 13:21
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No IE!
I really appreciate your work! Thanks, GeekDude.
Because sometimes, in rare occasions, the script freeze in Call function (in Chrome.ahk) waiting for response from Chrome, I moved the instruction to clear the flag (this.responses[ID] := False) before instruction to send command to Chrome: this.ws.Send(Chrome.Jxon_Dump….
Because multitasking environment, after sending to Chrome a command, sometimes Chrome can respond instantly, stop execution of our AHK script, execute the command and set the flag to True. Than resume our AHK script, but the script was setting the flag from True to False and freeze waiting.
Now, my Call function looks like this and works like a charm:
Code: Select all
Call(DomainAndMethod, Params:="", WaitForResponse:=True)
{
if !this.Connected
throw Exception("Not connected to tab")
;Use a temporary variable for ID in case more calls are made
;before we receive a response.
ID := this.ID += 1
this.responses[ID] := False ;<----- clear the flag was moved here
this.ws.Send(Chrome.Jxon_Dump({"id": ID
, "params": Params ? Params : {}
, "method": DomainAndMethod}))
if !WaitForResponse
return
;Wait for the response
;----- this.responses[ID] := False ;-----> clear the flag NOT here
while !this.responses[ID]
Sleep, 50
;Get the response, check if it's an error
response := this.responses.Delete(ID)
if (response.error)
throw Exception("Chrome indicated error in response",, Chrome.Jxon_Dump(response.error))
return response.result
}
-
- Posts: 2
- Joined: 09 Apr 2023, 04:37
Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No IE!
Hi,
Can chrome be started in minimize and/or hidden mode?
If yes how and would all the commands work?
Can chrome be started in minimize and/or hidden mode?
If yes how and would all the commands work?