It's a chromedriver bug people have already reported that.Flowgun wrote: ↑16 Dec 2022, 13:40@Xeo786
Thank you for your input and suggestion.
I tried using different drivers at different locations for each profile in the past, and I still got the error. I think that different profiles just require different User data dir to work correctly.
Having to create a different User Data dir adds a lot of friction. I want the experience to be as seamless as possible for the user, being able to open his profiles either with Rufaydium or the regular way.
If they move their other profile data dir to another location on disk, chrome would detect it I presume, and won't be able to open it the regular way. Since the folders can also get big, recopying and moving them each time to update is not a viable solution.
I will investigate this further whenever I find the time.
Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory
-
- Posts: 19
- Joined: 26 Aug 2022, 07:18
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
When trying to get the size or location of any element in chrome, I get the following error:
Is this normal behavior?
in firefox, I get an empty json.Size: {"error":"unknown command","message":"unknown command: Cannot call non W3C standard command while in W3C mode","stacktrace":"Backtrace:\n\tOrdinal0 [0x004FACD3+2075859]\n\tOrdinal0 [0x0048EE61+1633889]\n\tOrdinal0 [0x0038B7BD+571325]\n\tOrdinal0 [0x003B008C+721036]\n\tOrdinal0 [0x003B0F3F+724799]\n\tGetHandleVerifier [0x007AEED2+2769538]\n\tGetHandleVerifier [0x007A0D95+2711877]\n\tGetHandleVerifier [0x0058A03A+521194]\n\tGetHandleVerifier [0x00588DA0+516432]\n\tOrdinal0 [0x0049682C+1665068]\n\tOrdinal0 [0x0049B128+1683752]\n\tOrdinal0 [0x0049B215+1683989]\n\tOrdinal0 [0x004A6484+1729668]\n\tBaseThreadInitThunk [0x75E0FEF9+25]\n\tRtlGetAppContainerNamedObjectPath [0x77507BBE+286]\n\tRtlGetAppContainerNamedObjectPath [0x77507B8E+238]\n"}
Location: {"error":"unknown command","message":"unknown command: Cannot call non W3C standard command while in W3C mode","stacktrace":"Backtrace:\n\tOrdinal0 [0x004FACD3+2075859]\n\tOrdinal0 [0x0048EE61+1633889]\n\tOrdinal0 [0x0038B7BD+571325]\n\tOrdinal0 [0x003B008C+721036]\n\tOrdinal0 [0x003B0F3F+724799]\n\tGetHandleVerifier [0x007AEED2+2769538]\n\tGetHandleVerifier [0x007A0D95+2711877]\n\tGetHandleVerifier [0x0058A03A+521194]\n\tGetHandleVerifier [0x00588DA0+516432]\n\tOrdinal0 [0x0049682C+1665068]\n\tOrdinal0 [0x0049B128+1683752]\n\tOrdinal0 [0x0049B215+1683989]\n\tOrdinal0 [0x004A6484+1729668]\n\tBaseThreadInitThunk [0x75E0FEF9+25]\n\tRtlGetAppContainerNamedObjectPath [0x77507BBE+286]\n\tRtlGetAppContainerNamedObjectPath [0x77507B8E+238]\n"}
LocationInView: {"error":"unknown command","message":"unknown command: Cannot call non W3C standard command while in W3C mode","stacktrace":"Backtrace:\n\tOrdinal0 [0x004FACD3+2075859]\n\tOrdinal0 [0x0048EE61+1633889]\n\tOrdinal0 [0x0038B7BD+571325]\n\tOrdinal0 [0x003B008C+721036]\n\tOrdinal0 [0x003B0F3F+724799]\n\tGetHandleVerifier [0x007AEED2+2769538]\n\tGetHandleVerifier [0x007A0D95+2711877]\n\tGetHandleVerifier [0x0058A03A+521194]\n\tGetHandleVerifier [0x00588DA0+516432]\n\tOrdinal0 [0x0049682C+1665068]\n\tOrdinal0 [0x0049B128+1683752]\n\tOrdinal0 [0x0049B215+1683989]\n\tOrdinal0 [0x004A6484+1729668]\n\tBaseThreadInitThunk [0x75E0FEF9+25]\n\tRtlGetAppContainerNamedObjectPath [0x77507BBE+286]\n\tRtlGetAppContainerNamedObjectPath [0x77507B8E+238]\n"}
Is this normal behavior?
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Error says Rufaydium is calling non W3C standard API, Thanks for pointing out I have just removed them, you can use .rect Element.Rect() it will return with location and sizeyousef_badr23 wrote: ↑19 Dec 2022, 05:42When trying to get the size or location of any element in chrome, I get the following error:Size: {"error":"unknown command","message":"unknown command: Cannot call non W3C standard command while in W3C mode","stacktrace":"Backtrace:\n\tOrdinal0 [0x004FACD3+2075859]\n\tOrdinal0 [0x0048EE61+1633889]\n\tOrdinal0 [0x0038B7BD+571325]\n\tOrdinal0 [0x003B008C+721036]\n\tOrdinal0 [0x003B0F3F+724799]\n\tGetHandleVerifier [0x007AEED2+2769538]\n\tGetHandleVerifier [0x007A0D95+2711877]\n\tGetHandleVerifier [0x0058A03A+521194]\n\tGetHandleVerifier [0x00588DA0+516432]\n\tOrdinal0 [0x0049682C+1665068]\n\tOrdinal0 [0x0049B128+1683752]\n\tOrdinal0 [0x0049B215+1683989]\n\tOrdinal0 [0x004A6484+1729668]\n\tBaseThreadInitThunk [0x75E0FEF9+25]\n\tRtlGetAppContainerNamedObjectPath [0x77507BBE+286]\n\tRtlGetAppContainerNamedObjectPath [0x77507B8E+238]\n"}
Code: Select all
msgbox, % json.dump(Element.Rect(),1)
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Hello, I'm trying to get some understanding of classes using Rufaydium for a small project I have.
I'm having trouble retrieving the Chrome and ahkPage properties inside the methods, can someone please point me to what I'm doing wrong?
Thank you
I'm having trouble retrieving the Chrome and ahkPage properties inside the methods, can someone please point me to what I'm doing wrong?
Code: Select all
#Requires AutoHotkey v1.1
#NoEnv
#SingleInstance, Force
SendMode, Input
SetBatchLines, -1
SetWorkingDir, %A_ScriptDir%
;#Warn
#Include include\Rufaydium\Rufaydium.ahk
F1::Scrape.goPage()
F12::Scrape.Quit()
class Scrape
{
Chrome := new Rufaydium("chromedriver.exe")
ahkPage := "https://www.autohotkey.com"
goPage()
{
;this.Chrome := new Rufaydium("chromedriver.exe")
page := this.Chrome.NewSession()
page.Navigate(this.ahkPage)
return
}
Quit()
{
this.Chrome.QuitAllSessions()
this.Chrome.Driver.Exit()
return
}
}
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
This Post is dedicated to Rufaydium, You can ask for classes-dedicated posts, I suggest you should start with "Classes in AHK, Basic tutorial." or links mentioned hereDrX wrote: ↑19 Dec 2022, 17:06Hello, I'm trying to get some understanding of classes using Rufaydium for a small project I have.
I'm having trouble retrieving the Chrome and ahkPage properties inside the methods, can someone please point me to what I'm doing wrong?
Code: Select all
#Requires AutoHotkey v1.1 #NoEnv #SingleInstance, Force SendMode, Input SetBatchLines, -1 SetWorkingDir, %A_ScriptDir% ;#Warn #Include include\Rufaydium\Rufaydium.ahk F1::Scrape.goPage() F12::Scrape.Quit() class Scrape { Chrome := new Rufaydium("chromedriver.exe") ahkPage := "https://www.autohotkey.com" goPage() { ;this.Chrome := new Rufaydium("chromedriver.exe") page := this.Chrome.NewSession() page.Navigate(this.ahkPage) return } Quit() { this.Chrome.QuitAllSessions() this.Chrome.Driver.Exit() return } }
The method .goPage() is creating new session everytime, and Quit() will exit all session the driver, you can turn Chrome & ahkpagestatic variable
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Thank you for your reply sir.
I'm also wondering what the correct way to retrieve all links in a webpage? This seems to return empty
I'm also wondering what the correct way to retrieve all links in a webpage? This seems to return empty
Code: Select all
[spoiler2=]
Chrome := new Rufaydium("chromedriver.exe")
Page := Chrome.NewSession()
Page.Navigate("https://www.autohotkey.com")
Page.CDP.WaitForLoad()
Links := Page.getElementsbyTagName("a")
MsgBox, % Links
Return
[/spoiler2]
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
This is how you can get all the href idk if it would work for src too.
Code: Select all
Chrome := new Rufaydium()
Page := Chrome.NewSession()
Page.URL := "https://www.autohotkey.com/boards/viewtopic.php?f=6&t=102616&start=460"
elements := Page.findelements(By.Plinktext,"")
for i, e in elements
{
msgbox, % e.outerHtml "`n`nsrc:" e.src "`nhref:" e.href
}
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory
-
- Posts: 19
- Joined: 29 Nov 2022, 06:52
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Hello @Xeo786
I have a doubt.
Is there any way to get the page id in Firefox?
I used, but the returned id was: "ba1faf2b-4625-4ec7-9745-7fd1982b7296" (Main process target).
Is there any way to get the id of the active page otherwise without using the commands, RegExMatch and StrSplit over json.dump(Page.Detail(),1)?
json
I got it, but I had to use something like the code below:
I have a doubt.
Is there any way to get the page id in Firefox?
I used
Code: Select all
Page.id
Is there any way to get the id of the active page otherwise without using the commands, RegExMatch and StrSplit over json.dump(Page.Detail(),1)?
json
Code: Select all
[
{
"description": "",
"devtoolsFrontendUrl": null,
"faviconUrl": "",
"id": "293b2164-b3c4-49fb-b3ec-747386613224",
"type": "page",
"url": "https://www.mozilla.org/pt-BR/",
"webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/page/293b2164-b3c4-49fb-b3ec-747386613224"
},
{
"description": "Main process target",
"devtoolsFrontendUrl": "",
"faviconUrl": "",
"id": "ba1faf2b-4625-4ec7-9745-7fd1982b7296",
"title": "Main process target",
"type": "browser",
"url": "",
"webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/browser/ba1faf2b-4625-4ec7-9745-7fd1982b7296"
},
{
"description": "",
"devtoolsFrontendUrl": null,
"faviconUrl": "",
"id": "a89d417c-d038-445f-b259-5544fd439278",
"type": "page",
"url": "https://www.mozilla.org/pt-BR/about/",
"webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/page/a89d417c-d038-445f-b259-5544fd439278"
},
{
"description": "",
"devtoolsFrontendUrl": null,
"faviconUrl": "",
"id": "7494d12f-e512-4ddf-9329-88f28cc4c7dc",
"type": "page",
"url": "https://www.mozilla.org/pt-BR/contribute/",
"webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/page/7494d12f-e512-4ddf-9329-88f28cc4c7dc"
}
]
Code: Select all
id_firefox()
{
url_firefox := Get_url() ; url active on Firefox
for Index, current_tab in StrSplit(json.dump(Page.Detail(),1),"description"": """) ; code get here in this Forum
{
if Index > 1
{
if InStr(current_tab,"type"": ""page""")
{
; capture id tab
RegExMatch(current_tab, "id"": ""(.*)", id_tab, StartingPos := 1)
id_tab := StrReplace(id_tab,"id"": ","") ; kill id": "
id_tab := StrReplace(id_tab,"""","") ; kill "
id_tab := StrReplace(id_tab,",","") ; kill ,
; capture url
RegExMatch(current_tab, "url"": ""(.*)", url_tab, StartingPos := 1)
url_tab := StrReplace(url_tab,"url"": ","") ; retira url": "
url_tab := StrReplace(url_tab,"""","") ; retira todas as aspas
url_tab := StrReplace(url_tab,",","") ; retira todas as vírgulas
; compare
if url_tab = %url_firefox%
{
return id_tab
}
}
}
}
}
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Yes.Sadaosh1970 wrote: ↑21 Dec 2022, 17:25Hello @Xeo786
I have a doubt.
Is there any way to get the page id in Firefox?
Code: Select all
for i, obj in Page.Detail()
msgbox, % obj.id "`n" obj.url
Yes....! for chrome its always first [1] ID is active page id, I am not sure about firefox, please confirm if its same for FFSadaosh1970 wrote: ↑21 Dec 2022, 17:25Is there any way to get the id of the active page otherwise without using the commands, RegExMatch and StrSplit over json.dump(Page.Detail(),1)?
Code: Select all
msgbox, % Page.Detail()[1].id
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory
-
- Posts: 19
- Joined: 29 Nov 2022, 06:52
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
@Xeo786
This Works!!!
This Return id tab(1,1) on Firefox
This Works!!!
Code: Select all
for i, obj in Page.Detail()
msgbox, % obj.id "`n" obj.url
Code: Select all
msgbox, % Page.Detail()[1].id
-
- Posts: 19
- Joined: 29 Nov 2022, 06:52
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
I'm trying to capture the active url in Firefox, but still not active in Rufaydium.
I tried to use:
Sometimes it works. Other times not.
Does anyone have a way to do this?
For now, I´m using: send, ^a, send, ^c
Thanks in advance!
I tried to use:
Code: Select all
Page.ExecuteSync("navigator.clipboard.writeText(window.location.href)")
Does anyone have a way to do this?
For now, I´m using: send, ^a, send, ^c
Thanks in advance!
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
here is the work aroundSadaosh1970 wrote: ↑23 Dec 2022, 12:15I'm trying to capture the active url in Firefox, but still not active in Rufaydium.
I tried to use:Sometimes it works. Other times not.Code: Select all
Page.ExecuteSync("navigator.clipboard.writeText(window.location.href)")
Does anyone have a way to do this?
For now, I´m using: send, ^a, send, ^c
Thanks in advance!
Spoiler
now it's time to fix Page.Activetab() for firefoxEdit:
Fixed Page.Activetab() for firefox
update Rufaydium and try this one
Code: Select all
FF := new Rufaydium("geckodriver")
Page := FF.NewSession()
Page.URL := "https://www.autohotkey.com/boards/viewtopic.php?f=6&t=102616&start=460"
Page.NewTab()
Page.url := "https://www.autohotkey.com/boards/viewtopic.php?t=66204"
return
f2::
Page.Quit()
FF.Driver.Exit()
return
f1::
msgbox, % "Title: " page.title "`n`nLook at above title now manually change tab and press ok"
;page.switchbytitle(GetFFActivetitlebyPID(FF.Driver.PID))
page.ActiveTab()
msgbox, % "Title: " page.title "`n`n now rufaydium switched to active tab`n`nPress F2 to closed broswer"
return
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory
-
- Posts: 19
- Joined: 29 Nov 2022, 06:52
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Dear @Xeo786:
First, thank you for your reply. Your work is fantastic!
I had already noticed another problem using Firefox that seems to have arisen since the "Commits on Dec 5, 2022" update.
I'm using Rufaydium's version of "Commits on Dec 3, 2022" and everything works normally.
But as of "Dec 5, 2022" versions Rufaydium was no longer able to control the Firefox browser for me.
A new Firefox session starts, but nothing happens.
The ActiveSessions.ini file looks like this": [geckodriver]
http://"
Using Rufaydium's version of "Dec 3, 2022" and the code below, everything works.
But using the new version of Rufaydium "Commits on Dec 24, 2022" and the code below, a new Firefox session is opened, I noticed that Firefox's address bar flashes, but then nothing happens.
Thanks in advance if you can help me!
First, thank you for your reply. Your work is fantastic!
I had already noticed another problem using Firefox that seems to have arisen since the "Commits on Dec 5, 2022" update.
I'm using Rufaydium's version of "Commits on Dec 3, 2022" and everything works normally.
But as of "Dec 5, 2022" versions Rufaydium was no longer able to control the Firefox browser for me.
A new Firefox session starts, but nothing happens.
The ActiveSessions.ini file looks like this": [geckodriver]
http://"
Using Rufaydium's version of "Dec 3, 2022" and the code below, everything works.
Code: Select all
#Include %A_ScriptDir%\Rufaydium\Rufaydium.ahk
FF := new Rufaydium("geckodriver")
Page := FF.NewSession()
Page.URL := "https://www.autohotkey.com/boards/viewtopic.php?f=6&t=102616&start=460"
Page.NewTab()
Page.url := "https://www.autohotkey.com/boards/viewtopic.php?t=66204"
return
f2::
Page.Quit()
FF.Driver.Exit()
return
f1::
msgbox, % "Title: " page.title "`n`nLook at above title now manually change tab and press ok"
page.switchbytitle(GetFFActivetitlebyPID(FF.Driver.PID))
msgbox, % "Title: " page.title "`n`n now Rufaydium switched to active tab`n`nPress F2 to closed browser"
return
GetFFActivetitlebyPID(PID)
{
FFPID := GetFireFoxPID(PID)
wingettitle, title, % "ahk_pid " FFPID
title := strreplace(title," — Mozilla Firefox") ; "— make sure ahk is saved as uft-8 with BOM
return title
}
GetFireFoxPID(PID)
{
for proc in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process WHERE Name = 'firefox.exe'")
if ( proc.ParentProcessId = PID)
for proc2 in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process WHERE Name = 'firefox.exe'")
if ( proc2.ParentProcessId = proc.processid)
return proc2.processid
}
return
But using the new version of Rufaydium "Commits on Dec 24, 2022" and the code below, a new Firefox session is opened, I noticed that Firefox's address bar flashes, but then nothing happens.
Code: Select all
#Include %A_ScriptDir%\Rufaydium\Rufaydium.ahk
FF := new Rufaydium("geckodriver")
Page := FF.NewSession()
Page.URL := "https://www.autohotkey.com/boards/viewtopic.php?f=6&t=102616&start=460"
Page.NewTab()
Page.url := "https://www.autohotkey.com/boards/viewtopic.php?t=66204"
return
f2::
Page.Quit()
FF.Driver.Exit()
return
f1::
msgbox, % "Title: " page.title "`n`nLook at above title now manually change tab and press ok"
;page.switchbytitle(GetFFActivetitlebyPID(FF.Driver.PID))
page.ActiveTab()
msgbox, % "Title: " page.title "`n`n now rufaydium switched to active tab`n`nPress F2 to closed broswer"
return
-
- Posts: 19
- Joined: 29 Nov 2022, 06:52
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Just one more doubt:
If two different pages have the same title (but different urls), will Rufaydium be able to identify the active tab correctly?
Tanks in advance!
If two different pages have the same title (but different urls), will Rufaydium be able to identify the active tab correctly?
Tanks in advance!
-
- Posts: 19
- Joined: 29 Nov 2022, 06:52
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
I found the code below.
It returns the url of the page that is active in Firefox
I did some tests and it's working.
Is it possible to insert something similar in Rufaydium so that we can get the url of the page that is active in Firefox, since different pages can have the same title, despite having different urls?
Tank You again!!!
viewtopic.php?t=3702
It returns the url of the page that is active in Firefox
I did some tests and it's working.
Is it possible to insert something similar in Rufaydium so that we can get the url of the page that is active in Firefox, since different pages can have the same title, despite having different urls?
Tank You again!!!
viewtopic.php?t=3702
Code: Select all
; AutoHotkey Version: AutoHotkey 1.1
; Language: English
; Platform: Win7 SP1 / Win8.1 / Win10
; Author: Antonio Bueno <user atnbueno of Google's popular e-mail service>
; Short description: Gets the URL of the current (active) browser tab for most modern browsers
; Last Mod: 2016-05-19
Menu, Tray, Icon, % A_WinDir "\system32\netshell.dll", 86 ; Shows a world icon in the system tray
ModernBrowsers := "ApplicationFrameWindow,Chrome_WidgetWin_0,Chrome_WidgetWin_1,Maxthon3Cls_MainFrm,MozillaWindowClass,Slimjet_WidgetWin_1"
LegacyBrowsers := "IEFrame,OperaWindowClass"
^+!u::
nTime := A_TickCount
sURL := GetActiveBrowserURL()
WinGetClass, sClass, A
If (sURL != "")
MsgBox, % "The URL is """ sURL """`nEllapsed time: " (A_TickCount - nTime) " ms (" sClass ")"
Else If sClass In % ModernBrowsers "," LegacyBrowsers
MsgBox, % "The URL couldn't be determined (" sClass ")"
Else
MsgBox, % "Not a browser or browser not supported (" sClass ")"
Return
GetActiveBrowserURL() {
global ModernBrowsers, LegacyBrowsers
WinGetClass, sClass, A
If sClass In % ModernBrowsers
Return GetBrowserURL_ACC(sClass)
Else If sClass In % LegacyBrowsers
Return GetBrowserURL_DDE(sClass) ; empty string if DDE not supported (or not a browser)
Else
Return ""
}
; "GetBrowserURL_DDE" adapted from DDE code by Sean, (AHK_L version by maraskan_user)
; Found at http://autohotkey.com/board/topic/17633-/?p=434518
GetBrowserURL_DDE(sClass) {
WinGet, sServer, ProcessName, % "ahk_class " sClass
StringTrimRight, sServer, sServer, 4
iCodePage := A_IsUnicode ? 0x04B0 : 0x03EC ; 0x04B0 = CP_WINUNICODE, 0x03EC = CP_WINANSI
DllCall("DdeInitialize", "UPtrP", idInst, "Uint", 0, "Uint", 0, "Uint", 0)
hServer := DllCall("DdeCreateStringHandle", "UPtr", idInst, "Str", sServer, "int", iCodePage)
hTopic := DllCall("DdeCreateStringHandle", "UPtr", idInst, "Str", "WWW_GetWindowInfo", "int", iCodePage)
hItem := DllCall("DdeCreateStringHandle", "UPtr", idInst, "Str", "0xFFFFFFFF", "int", iCodePage)
hConv := DllCall("DdeConnect", "UPtr", idInst, "UPtr", hServer, "UPtr", hTopic, "Uint", 0)
hData := DllCall("DdeClientTransaction", "Uint", 0, "Uint", 0, "UPtr", hConv, "UPtr", hItem, "UInt", 1, "Uint", 0x20B0, "Uint", 10000, "UPtrP", nResult) ; 0x20B0 = XTYP_REQUEST, 10000 = 10s timeout
sData := DllCall("DdeAccessData", "Uint", hData, "Uint", 0, "Str")
DllCall("DdeFreeStringHandle", "UPtr", idInst, "UPtr", hServer)
DllCall("DdeFreeStringHandle", "UPtr", idInst, "UPtr", hTopic)
DllCall("DdeFreeStringHandle", "UPtr", idInst, "UPtr", hItem)
DllCall("DdeUnaccessData", "UPtr", hData)
DllCall("DdeFreeDataHandle", "UPtr", hData)
DllCall("DdeDisconnect", "UPtr", hConv)
DllCall("DdeUninitialize", "UPtr", idInst)
csvWindowInfo := StrGet(&sData, "CP0")
StringSplit, sWindowInfo, csvWindowInfo, `" ;"; comment to avoid a syntax highlighting issue in autohotkey.com/boards
Return sWindowInfo2
}
GetBrowserURL_ACC(sClass) {
global nWindow, accAddressBar
If (nWindow != WinExist("ahk_class " sClass)) ; reuses accAddressBar if it's the same window
{
nWindow := WinExist("ahk_class " sClass)
accAddressBar := GetAddressBar(Acc_ObjectFromWindow(nWindow))
}
Try sURL := accAddressBar.accValue(0)
If (sURL == "") {
WinGet, nWindows, List, % "ahk_class " sClass ; In case of a nested browser window as in the old CoolNovo (TO DO: check if still needed)
If (nWindows > 1) {
accAddressBar := GetAddressBar(Acc_ObjectFromWindow(nWindows2))
Try sURL := accAddressBar.accValue(0)
}
}
If ((sURL != "") and (SubStr(sURL, 1, 4) != "http")) ; Modern browsers omit "http://"
sURL := "http://" sURL
If (sURL == "")
nWindow := -1 ; Don't remember the window if there is no URL
Return sURL
}
; "GetAddressBar" based in code by uname
; Found at http://autohotkey.com/board/topic/103178-/?p=637687
GetAddressBar(accObj) {
Try If ((accObj.accRole(0) == 42) and IsURL(accObj.accValue(0)))
Return accObj
Try If ((accObj.accRole(0) == 42) and IsURL("http://" accObj.accValue(0))) ; Modern browsers omit "http://"
Return accObj
For nChild, accChild in Acc_Children(accObj)
If IsObject(accAddressBar := GetAddressBar(accChild))
Return accAddressBar
}
IsURL(sURL) {
Return RegExMatch(sURL, "^(?<Protocol>https?|ftp)://(?<Domain>(?:[\w-]+\.)+\w\w+)(?::(?<Port>\d+))?/?(?<Path>(?:[^:/?# ]*/?)+)(?:\?(?<Query>[^#]+)?)?(?:\#(?<Hash>.+)?)?$")
}
; The code below is part of the Acc.ahk Standard Library by Sean (updated by jethrow)
; Found at http://autohotkey.com/board/topic/77303-/?p=491516
Acc_Init()
{
static h
If Not h
h:=DllCall("LoadLibrary","Str","oleacc","Ptr")
}
Acc_ObjectFromWindow(hWnd, idObject = 0)
{
Acc_Init()
If DllCall("oleacc\AccessibleObjectFromWindow", "Ptr", hWnd, "UInt", idObject&=0xFFFFFFFF, "Ptr", -VarSetCapacity(IID,16)+NumPut(idObject==0xFFFFFFF0?0x46000000000000C0:0x719B3800AA000C81,NumPut(idObject==0xFFFFFFF0?0x0000000000020400:0x11CF3C3D618736E0,IID,"Int64"),"Int64"), "Ptr*", pacc)=0
Return ComObjEnwrap(9,pacc,1)
}
Acc_Query(Acc) {
Try Return ComObj(9, ComObjQuery(Acc,"{618736e0-3c3d-11cf-810c-00aa00389b71}"), 1)
}
Acc_Children(Acc) {
If ComObjType(Acc,"Name") != "IAccessible"
ErrorLevel := "Invalid IAccessible Object"
Else {
Acc_Init(), cChildren:=Acc.accChildCount, Children:=[]
If DllCall("oleacc\AccessibleChildren", "Ptr",ComObjValue(Acc), "Int",0, "Int",cChildren, "Ptr",VarSetCapacity(varChildren,cChildren*(8+2*A_PtrSize),0)*0+&varChildren, "Int*",cChildren)=0 {
Loop %cChildren%
i:=(A_Index-1)*(A_PtrSize*2+8)+8, child:=NumGet(varChildren,i), Children.Insert(NumGet(varChildren,i-8)=9?Acc_Query(child):child), NumGet(varChildren,i-8)=9?ObjRelease(child):
Return Children.MaxIndex()?Children:
} Else
ErrorLevel := "AccessibleChildren DllCall Failed"
}
}
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
it's vice versa same title with a different URL and different URLs can have the same title, but we need to find out Handle of the active tab which was possible for chrome,Sadaosh1970 wrote: ↑24 Dec 2022, 12:18Is it possible to insert something similar in Rufaydium so that we can get the url of the page that is active in Firefox, since different pages can have the same title, despite having different urls?
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory
-
- Posts: 19
- Joined: 29 Nov 2022, 06:52
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
For now, I'm using the script that I found in viewtopic.php?t=3702 and it works to discover the url of the active page in Firefox (if there aren't two different pages with the same url), then I pass control of that page to the Rufaydium.
Congratulations for your work. It's much simpler than using Selenium, even newbies like me can use it.
On the other hand, could you please confirm that the latest version of Rufaydium really cannot control Firefox?
Thanks in advance.
Congratulations for your work. It's much simpler than using Selenium, even newbies like me can use it.
On the other hand, could you please confirm that the latest version of Rufaydium really cannot control Firefox?
Thanks in advance.
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Such an amazing lib, hadn't time to check it out yet but yeah, I've been using it a bit and it's deffinitely a big contribution!
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Yeah, but .activetab() bug persists, as you mentioned if someone opened multiple tabs with the same title it will activate the latest found tab, the simple and best way is to make records of all tabs now you know every tab, and which to access.Sadaosh1970 wrote: ↑26 Dec 2022, 08:41For now, I'm using the script that I found in viewtopic.php?t=3702 and it works to discover the url of the active page in Firefox (if there aren't two different pages with the same url), then I pass control of that page to the Rufaydium.
Congratulations for your work. It's much simpler than using Selenium, even newbies like me can use it.
On the other hand, could you please confirm that the latest version of Rufaydium really cannot control Firefox?
Thanks in advance.
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory
-
- Posts: 19
- Joined: 29 Nov 2022, 06:52
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Thank you.
.activetab() latest tab is good.
But the latest version of Rufaydium can no longer get into Firefox.
.activetab() latest tab is good.
But the latest version of Rufaydium can no longer get into Firefox.
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: No registered users and 114 guests