Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post your working scripts, libraries and tools for AHK v1.1 and older
cristalgrip
Posts: 36
Joined: 19 Feb 2023, 15:52

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

13 Nov 2023, 15:17

Is possible to select a canvas inside an Iframe? I need to perform a click using javascript but I'm not sure if is possible. Changing frame level and the function Evaluate to send javascript code doesn't seem to work together.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

14 Nov 2023, 01:25

cristalgrip wrote:
13 Nov 2023, 15:17
Is possible to select a canvas inside an Iframe? I need to perform a click using javascript but I'm not sure if is possible. Changing frame level and the function Evaluate to send javascript code doesn't seem to work together.
Sure can you just need to be in the correct iFrame.
cristalgrip
Posts: 36
Joined: 19 Feb 2023, 15:52

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

14 Nov 2023, 04:13

Xtra wrote:
14 Nov 2023, 01:25
cristalgrip wrote:
13 Nov 2023, 15:17
Is possible to select a canvas inside an Iframe? I need to perform a click using javascript but I'm not sure if is possible. Changing frame level and the function Evaluate to send javascript code doesn't seem to work together.
Sure can you just need to be in the correct iFrame.
Can you be more specific or do an example?
One crucial thing I forgot to mention is that I'm talking about an Cross-origin iframe, so the same-origin policy doesn't allow to run any javascript if I'm not alredy "inside" the iframe.

Thx!
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

14 Nov 2023, 12:06

If you can get a reference to the element you are trying to click and then Rufaydium clicks do not work, there is nothing you can do. Just try to click without using any javascript.

I dont have an example that you would have access to.

Your options:
https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy#cross-origin_script_api_access
cristalgrip
Posts: 36
Joined: 19 Feb 2023, 15:52

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

15 Nov 2023, 12:15

Sorry I just found out what I was missing. My problem is that "Page.ExecuteSync()" is not very documented.
separateattention
Posts: 16
Joined: 19 Oct 2022, 15:30

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

15 Dec 2023, 15:56

separateattention wrote:
18 Aug 2023, 14:07
Xeo786 wrote:
18 Aug 2023, 11:27
separateattention wrote:
17 Aug 2023, 14:50
separateattention wrote:
29 Jun 2023, 10:37
Hey Xeo, can you help me with this code:

Code: 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
Even with Chrome.capabilities.addArg("--headless") and Chrome.capabilities.HeadlessMode := true, Im still get a windows that says
User is required to install "wkhtmltopdf" in order to enable pdf printing without headless mode
Any idea?
@Xeo786 sorry but cant still figure this out :(
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 installed
That's my problem, the browser IS in headless mode, but still asking for "wkhtmltopdf", any idea?

@Xeo786 hey, some insight about this, commenting out this part of the code and removing the if if this.Capabilities.HeadlessMode in the main Rufaydium.ahk seems to fix the problem and now I can print in headless mode.

screenshot.png
screenshot.png (75.24 KiB) Viewed 1484 times
cristalgrip
Posts: 36
Joined: 19 Feb 2023, 15:52

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

28 Jan 2024, 08:35

The latest version of Microsoft Edge is 121.0.2277.83.

With this version, Rafaydium is reporting an error ("cannot find msedge binary") with the new 'Microsoft Edge WebDriver.' I've even tried downloading it manually, but the issue persists.
separateattention
Posts: 16
Joined: 19 Oct 2022, 15:30

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

29 Jan 2024, 12:41

cristalgrip wrote:
28 Jan 2024, 08:35
The latest version of Microsoft Edge is 121.0.2277.83.

With this version, Rafaydium is reporting an error ("cannot find msedge binary") with the new 'Microsoft Edge WebDriver.' I've even tried downloading it manually, but the issue persists.
You can fix that pointing to the exe:

Code: Select all

WB := MSEdge.NewSession("C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe")
Mine is set up like this:

Code: Select all

#Include Rufaydium.ahk

Driver:= "C:\Users\" A_UserName "\Documents\msedgedriver.exe"

MSEdge := new Rufaydium(Driver)
MSEdge.capabilities.addArg("--disable-dev-shm-usage")
MSEdge.capabilities.setUserProfile("Default") ; this load profile 1 according to image
WB := MSEdge.NewSession("C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe")

WB.Navigate("http://...")

return

cristalgrip
Posts: 36
Joined: 19 Feb 2023, 15:52

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

29 Jan 2024, 14:20

You are right! Absolutely perfect. Thank you very much! It's strange because when generating the new webdriver (for the new version of Edge), Rafaydium indicates the correct path.

I am really grateful to you.
cristalgrip
Posts: 36
Joined: 19 Feb 2023, 15:52

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

27 Feb 2024, 03:38

There is a way to get the PID of Browser launched by Rufaydium WebDriver?
cristalgrip
Posts: 36
Joined: 19 Feb 2023, 15:52

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

01 Mar 2024, 18:03

cristalgrip wrote:
27 Feb 2024, 03:38
There is a way to get the PID of Browser launched by Rufaydium WebDriver?
I've been exploring a solution in Rafaydium.ahk that involves matching the (PID) of "msedgedriver.exe" with the Parent PID of each instance of "msedge.exe". If they correspond, then the PID of msedge.exe is the one created by that particular webdriver.

However, I've encountered a significant drawback in this approach. If the browser or the webdriver are not closed correctly, the old session remains open with the same PID of "msedgedriver.exe". As a result, the PID returned is incorrect.

Code: Select all

.....

Class Session
{

	__new(i)
	{
		this.id := i.id
		this.Address := i.address
		this.debuggerAddress := i.debuggerAddress
		this.Build := i.Build
		this.name := i.name
		if i.websocketurl
			this.websocketurl := i.websocketurl
		this.currentTab := this.Send("window","GET")
		switch i.name
		{
			case "chromedriver" :
				this.CDP := new CDP(this.Address)
			case "msedgedriver" :
				this.CDP := new CDP(this.Address)
				for proc in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process WHERE Name = 'msedge.exe'")
				{
					ParentProcessId:=proc.ParentProcessId
					processid:=proc.processid
					DriverPID:= i.DriverPID
					if(DriverPID=ParentProcessId){
						msgbox, %DriverPID% - %ParentProcessId% ---- %processid% 
					}
				}	
			case "operadriver" :
				this.CDP := new CDP(this.Address)
			case "geckodriver" :
				for proc in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process WHERE Name = 'firefox.exe'")
					if ( proc.ParentProcessId = i.DriverPID)
						for proc2 in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process WHERE Name = 'firefox.exe'")
							if ( proc2.ParentProcessId = proc.processid)
							{
								this.BroswerPID := proc2.processid
								break
							} 
		}
	}
	
	......
nonchita
Posts: 2
Joined: 04 Apr 2024, 10:56

Re : Rufaydium WebDriver 1.7.2 (셀레늄/웹소켓 없음)

04 Apr 2024, 11:18

[인용:JerryMaguire post_id=518848 time=1682261456 user_id=156994]
[인용:JerryMaguire post_id=518509 time=1682078835 user_id=156994]
@Xeo786속

팝업창의 확인 버튼을 클릭하고 Autohotkey의 WinExist(WinTitle)를 사용하여 창을 활성화하고 Send {Enter} 또는 Send {Space}를 사용하여 클릭하는 솔루션을 찾았습니다.
확인 버튼
[/인용]

참조용 코드를 제공할 수 있습니다.
[/인용]
how can use session.alret("accept") ?? plz show me sample


[Mod edit: Removed big, empty code box. Not even sure what else was intended here so leaving as-is.]
nonchita
Posts: 2
Joined: 04 Apr 2024, 10:56

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

04 Apr 2024, 19:41

example

Code: Select all

#Include Rufaydium-Webdriver-main\Rufaydium.ahk
Chrome := new Rufaydium()
Page := Chrome.NewSession()
url:="https://whm.ala-888.com/auth/login"

Confirm := Page.querySelectorAll(".btn.btn-info.approve")[1] ;
Confirm.Click()
>>>>a confirmation prompt window appears in Chrome

question
When I click the button through the code above, a confirmation prompt window appears in Chrome, but there is no way to click it.
Is there a separate way to click on the prompt window in Rufaydium? If so, please provide an example code.
Session.alert("accept") <<< use this??? but how can use it? plz help me


[Mod edit: Moved Codebox tags to be around the code, not at the top of the post.]
User avatar
Xeo786
Posts: 760
Joined: 09 Nov 2015, 02:43
Location: Karachi, Pakistan

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

21 Apr 2024, 09:09

nonchita wrote:
04 Apr 2024, 19:41
example

Code: Select all

#Include Rufaydium-Webdriver-main\Rufaydium.ahk
Chrome := new Rufaydium()
Page := Chrome.NewSession()
url:="https://whm.ala-888.com/auth/login"

Confirm := Page.querySelectorAll(".btn.btn-info.approve")[1] ;
Confirm.Click()
>>>>a confirmation prompt window appears in Chrome

question
When I click the button through the code above, a confirmation prompt window appears in Chrome, but there is no way to click it.
Is there a separate way to click on the prompt window in Rufaydium? If so, please provide an example code.
Session.alert("accept") <<< use this??? but how can use it? plz help me


[Mod edit: Moved Codebox tags to be around the code, not at the top of the post.]
those are user prompts by default they are dismiss so you can use 'Session.alert("accept")' session represents session instance which 'page' in your case.

Code: Select all

#Include Rufaydium-Webdriver-main\Rufaydium.ahk
Chrome := new Rufaydium()
Page := Chrome.NewSession()
url:="https://whm.ala-888.com/auth/login"

Confirm := Page.querySelectorAll(".btn.btn-info.approve")[1] ;
Confirm.Click()
Page .alert("accept")
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: gwarble, wilkster, xavierarmand and 125 guests