if browser is not in headless mode Rufaydium will try to use whtmltopdf taht is 3rd party toll that converts html to pdf using commandline and method will be used if whtmltopdf is installedseparateattention wrote: ↑17 Aug 2023, 14:50@Xeo786 sorry but cant still figure this outseparateattention wrote: ↑29 Jun 2023, 10:37Hey Xeo, can you help me with this code:
Even with Chrome.capabilities.addArg("--headless") and Chrome.capabilities.HeadlessMode := true, Im still get a windows that saysCode: Select all
Driver := "some directory" Chrome := new Rufaydium(Driver) Chrome.capabilities.addArg("--headless") Chrome.capabilities.HeadlessMode := true Chrome.capabilities.setUserProfile("Default") Page := Chrome.NewSession() Page.Navigate("https:...") Page.print("C:\Users\...\Downloads\test.pdf",PrintOptions.A4_Default) return
Any idea?User is required to install "wkhtmltopdf" in order to enable pdf printing without headless mode
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: 16
- Joined: 05 Mar 2023, 11:17
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
@Xeo786
now chromedriver.exe support win64, in WDM.ahk chromedriver.exe only download chromedriver-win32.zip
Is there a necessary reason?
-
- Posts: 16
- Joined: 19 Oct 2022, 15:30
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
That's my problem, the browser IS in headless mode, but still asking for "wkhtmltopdf", any idea?Xeo786 wrote: ↑18 Aug 2023, 11:27if browser is not in headless mode Rufaydium will try to use whtmltopdf taht is 3rd party toll that converts html to pdf using commandline and method will be used if whtmltopdf is installedseparateattention wrote: ↑17 Aug 2023, 14:50@Xeo786 sorry but cant still figure this outseparateattention wrote: ↑29 Jun 2023, 10:37Hey Xeo, can you help me with this code:
Even with Chrome.capabilities.addArg("--headless") and Chrome.capabilities.HeadlessMode := true, Im still get a windows that saysCode: Select all
Driver := "some directory" Chrome := new Rufaydium(Driver) Chrome.capabilities.addArg("--headless") Chrome.capabilities.HeadlessMode := true Chrome.capabilities.setUserProfile("Default") Page := Chrome.NewSession() Page.Navigate("https:...") Page.print("C:\Users\...\Downloads\test.pdf",PrintOptions.A4_Default) return
Any idea?User is required to install "wkhtmltopdf" in order to enable pdf printing without headless mode
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
In case you're still searching for a solution: Did you try to make the hidden headless window temporarily visible with winshow (DetectHiddenWindows, On will be needed to find the handle)?yousef_badr23 wrote: ↑15 Mar 2023, 09:32Is there a way to disable headless mode without starting a new browser object/ restarting the script?
I want to be able to fix login trouble / captcha if they occur then hide the window again, but keep headless mode as the default since errors like captcha are rare
If that's not working, you could also use the normal mode and hide/show the browser window with the window commands as needed.
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Xeo, thank you for creating this awesome library! It simplifies the work with the webdriver in a great way.Xeo786 wrote: ↑29 Mar 2023, 06:19btw I just noticed Extension location should be base64
So I made few changes in capabilities to conver exension path to base64 but still I am unable to create session with addextension, Error says cannot unzipCode: Select all
Chrome := new Rufaydium() extension := "C:\Users\irfan.exportho\Desktop\ChatGPT\extension_1_1_0_0.crx" Chrome.Capabilities.Addextensions(extension) ; << cause error for me may be I am not doing proper base64 or I do not know the correct formate page := Chrome.NewSession() page.url := "google.com"
Were you able to solve the path issue? Could it actually be that not the path should be base64-encoded but the Chrome extension file?
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
@Xeo786
How do you like the idea to add object support to ExecuteSync? Then we could hand over several objects as arguments to operate on.
Here's a working example:
To test it, I modified Session.ExecuteSync() based on your code in WDElement.Execute():
And WDElement.Execute() would then be modified to this:
How do you like the idea to add object support to ExecuteSync? Then we could hand over several objects as arguments to operate on.
Here's a working example:
Code: Select all
#include Rufaydium.ahk
Chrome:=new Rufaydium()
page:=Chrome.NewSession(), page.url:="google.com"
e:=page.getElementsByTagName("img")[0], p:=e.parentElement
page.ExecuteSync("arguments[0].removeChild(arguments[1])", p, e)
Code: Select all
ExecuteSync(Script,Args*)
{
args_:=[], rollback:=[], origins:=[]
for index, param in Args
if isobject(param)
origins.push(Origin:=param.address), regexmatch(Origin, "(.*)\/element\/(.*)$", i), param.address:=i1, rollback.push(param), args_.push({param.Element:i2})
else args_.push(param)
r:=this.Send("execute/sync", "POST", {"script":Script,"args":args_}, 1)
for index, param in rollback
param.address:=origins[index]
return r
}
Code: Select all
Execute(script)
{
return this.ExecuteSync(script,this)
}
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
@Xeo786
I have also a different topic, page.CDP is not accessible with Edge (version 115.0.1901.203 on Win10). The creation of the object fails in this step:
root.error then dumps to:
{"error": "unknown command", "message": "unknown command: unknown command: session/8e15487306850f817614e4c0d90eb46a/goog/cdp/execute", "stacktrace": "Backtrace:\n\tGetHandleVerifier [0x00007FF6C8C85422+69586]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty ..
Could it be that some security setting in Edge configuration options is needed to allow devtools access via debug port?
I have also a different topic, page.CDP is not accessible with Edge (version 115.0.1901.203 on Win10). The creation of the object fails in this step:
Code: Select all
__new(Address)
{
this.address := Address
root := this.call("DOM.getDocument",{"depth": 0}) ;this.call("DOM.getDocument",{"":""}) <===== the query doesn't receive the document object
{"error": "unknown command", "message": "unknown command: unknown command: session/8e15487306850f817614e4c0d90eb46a/goog/cdp/execute", "stacktrace": "Backtrace:\n\tGetHandleVerifier [0x00007FF6C8C85422+69586]\n\tMicrosoft::Applications::Events::EventProperty::~EventProperty ..
Could it be that some security setting in Edge configuration options is needed to allow devtools access via debug port?
-
- Posts: 36
- Joined: 19 Feb 2023, 15:52
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
I keep receiving this error and Chrome is the last stable version.
Version 116.0.5845.97 (a 64 bit) The same error appears if I download the chromedriver manually.
Am I the only one with this problem?
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
@cristalgrip
Does the version of chromedriver match with the browser version (116.0.5845.97)?
Bitness shouldn't be of importance as the communication between the webdriver and the browser is run through sockets.
Does the version of chromedriver match with the browser version (116.0.5845.97)?
Bitness shouldn't be of importance as the communication between the webdriver and the browser is run through sockets.
-
- Posts: 36
- Joined: 19 Feb 2023, 15:52
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Driver: Version 116.0.5845.96
CHrome: Version 116.0.5845.97
I'll just wait the next one
CHrome: Version 116.0.5845.97
I'll just wait the next one
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
@cristalgrip
If you want you can also install Chrome version 116.0.5845.96 to test if the issue is related to the outdated version of the webdriver.
Link from here: https://chromedriver.chromium.org/downloads/version-selection
-> Download link collection, latest Chrome + ChromeDriver releases: https://googlechromelabs.github.io/chrome-for-testing
If you want you can also install Chrome version 116.0.5845.96 to test if the issue is related to the outdated version of the webdriver.
Link from here: https://chromedriver.chromium.org/downloads/version-selection
-> Download link collection, latest Chrome + ChromeDriver releases: https://googlechromelabs.github.io/chrome-for-testing
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Hello, I'm new to AHK. I have a question. Why does the following code work:
But this code doesn't work:
Can someone explain why the second option doesn't work and if there are any ways to make it work?
In general, I want to find an element on a website, get its position and size, and click inside the element at a random position, something like this:
Can someone suggest the correct approach to implement this? Sorry for my English, and thank you for your help.
Code: Select all
MouseEvents := new mouse()
MouseEvents.press(0)
MouseEvent.move(288,258,10)
MouseEvent.release()
Session.Actions(MouseEvent)
Code: Select all
MouseEvents := new mouse()
MouseEvents.press(0)
x := 288
y := 256
MouseEvent.move(x, y10)
MouseEvent.release()
Session.Actions(MouseEvent)
In general, I want to find an element on a website, get its position and size, and click inside the element at a random position, something like this:
Code: Select all
MouseEvent := new mouse()
Loop {
element := Page.QuerySelector(".selector")
if (element.Enabled()) {
rect := element.Rect()
x1 := rect.x
y1 := rect.y
Random, x2, 0, rect.width
Random, y2, 0, rect.height
MouseEvent.press(0)
MouseEvent.move(x1 + x2, y1 + y2, 10)
MouseEvent.release()
Page.Actions(MouseEvent)
}
}
-
- Posts: 7
- Joined: 14 Feb 2023, 14:55
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Where is the "Getting Started" guide for Rufaydium? (I've seen the Readme.) It seems to require that I download main.zip? How do I install it and where do I put it, etc.?
Does Rufaydium require that Chrome be run in debug mode?
Thanks.
Does Rufaydium require that Chrome be run in debug mode?
Thanks.
-
- Posts: 112
- Joined: 06 Jun 2016, 21:32
Re: Rufaydium WebDriver (no selenium/websocket)
Hello friend,,Xeo786 wrote: ↑12 Apr 2022, 00:11Examples have been moved to Github
https://github.com/Xeo786/Rufaydium-Webdriver/blob/main/README.md
I would like to know that how to import current flag setting in new rufaydium session?
because i have noticed that new chrome rufaydium session starts with all flags settings disabled,
Thanks,
Waiting for reply...
-
- Posts: 3
- Joined: 19 Oct 2023, 14:03
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Hello, I want to click a link like ctrl + click. The lib can do that ?
The website have a button like this:
I want to click open the link but not change the current tab
The website have a button like this:
Code: Select all
<span onclick="funcjs['open_window'](1448169, 'ads', 'ads-1448169', 'no', '');" class="go-link-youtube">Приступить к выполнению</span>
-
- Posts: 3
- Joined: 19 Oct 2023, 14:03
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Q1: How to get the ahk_id or ahk_pid of the browser opened ?
Q2: Can I close the tab and no need to switch tab ? I'm in the first tab and I want to close the second tab, if script switch the tab, the browser will active. I need make the script run like I click a link with ctrl + click, wait for some minutes close the new tab. Thank you !
Q2: Can I close the tab and no need to switch tab ? I'm in the first tab and I want to close the second tab, if script switch the tab, the browser will active. I need make the script run like I click a link with ctrl + click, wait for some minutes close the new tab. Thank you !
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Good morning everyone,
I wonder if this is the correct section of the form, but I’ll try writing my question here. I’ve been using this library for some time now, and I find it truly excellent. However, I’d like to know if there’s a limit to the number of connections that the Chromedriver can make on the same machine but with different users. Currently, it seems that the limit is 3, as beyond this number our scripts fail to open a new connection or, if they do, the browser opens within another user’s window.
Thank you for your attention!
I await your feedback
@Xeo786
I wonder if this is the correct section of the form, but I’ll try writing my question here. I’ve been using this library for some time now, and I find it truly excellent. However, I’d like to know if there’s a limit to the number of connections that the Chromedriver can make on the same machine but with different users. Currently, it seems that the limit is 3, as beyond this number our scripts fail to open a new connection or, if they do, the browser opens within another user’s window.
Thank you for your attention!
I await your feedback
@Xeo786
-
- Posts: 3
- Joined: 19 Oct 2023, 14:03
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Hello, anyone know how to get the chrome.exe pid opened by rufaydium...
I want to use #IfWinActive but I don't know how to get the pid
I want to use #IfWinActive but I don't know how to get the pid
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
For each session use a unique port number:CarlV wrote: ↑02 Nov 2023, 04:37Good morning everyone,
I wonder if this is the correct section of the form, but I’ll try writing my question here. I’ve been using this library for some time now, and I find it truly excellent. However, I’d like to know if there’s a limit to the number of connections that the Chromedriver can make on the same machine but with different users. Currently, it seems that the limit is 3, as beyond this number our scripts fail to open a new connection or, if they do, the browser opens within another user’s window.
Thank you for your attention!
I await your feedback
@Xeo786
Chrome := new Rufaydium(A_ScriptDir . "\chromedriver.exe", "--port=9515")
Use: 9515, 9516, 9517, 9518, 9519 etc.
I just did a project with 10 users logged into a terminal server. It works fine after setting unique ports.
Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)
Reporting a possible issue:
When getting innerText and the text is 0 (zero) the returned value is blank.
I have tried every method to get it to work. CDP, ExecuteSync, querySelector etc.
In Chrome dev tools console it works like expected.
It may be caused by AHK treating 0 as false aka blank.
Example demo:
Thanks for all the work you put into this its much appreciated.
When getting innerText and the text is 0 (zero) the returned value is blank.
I have tried every method to get it to work. CDP, ExecuteSync, querySelector etc.
In Chrome dev tools console it works like expected.
It may be caused by AHK treating 0 as false aka blank.
Example demo:
Code: Select all
#NoEnv
#SingleInstance, Ignore
SetWorkingDir %A_ScriptDir%
;----------------------------------------
global Chrome
global Driver
OnExit("CloseDriver")
StartDriver()
driver.url := "https://www.saucedemo.com/"
WaitForReadyState()
driver.ExecuteSync("document.querySelector('div.login_password > h4').innerText = '1';")
WaitForReadyState()
; Works:
MsgBox, 4096, innerText = 1, % driver.ExecuteSync("return document.querySelector('div.login_password > h4').innerText;")
driver.ExecuteSync("document.querySelector('div.login_password > h4').innerText = '0';")
WaitForReadyState()
; Fails
MsgBox, 4096, innerText = 0, % driver.ExecuteSync("return document.querySelector('div.login_password > h4').innerText;")
MsgBox done
ExitApp
StartDriver() {
Chrome := new Rufaydium(A_ScriptDir . "\chromedriver.exe", "--port=9515")
Chrome.capabilities.AddexcludeSwitches("enable-automation")
Chrome.capabilities.IncognitoMode := true
Chrome.capabilities.addArg("--disable-print-preview")
Chrome.capabilities.addArg("--disk-cache-size=10000000")
Chrome.capabilities.addArg("--start-maximized")
driver := Chrome.NewSession()
}
CloseDriver() {
Chrome.QuitAllSessions()
Chrome.Driver.Exit()
}
WaitForReadyState() {
driver.CDP.WaitForLoad()
Sleep 1000
}
#Include W3C\Rufaydium.ahk