Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
Xeo786
Posts: 759
Joined: 09 Nov 2015, 02:43
Location: Karachi, Pakistan

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by Xeo786 » 01 Apr 2023, 03:48

magusneo wrote:
01 Apr 2023, 00:24
Xeo786 wrote:
28 Mar 2023, 23:44
magusneo wrote:
28 Mar 2023, 11:17
Can Rufaydium pass the Cloudflare bot checking?
check this site:https://nowsecure.nl//
chrome can't visit it if starting with chromedriver.exe.
yes :shh: here

How can Rufaydium visit https://chat.openai.com/?It always tell me to verify even with the following code

Code: Select all

chrome.Capabilities.addArg("--disable-blink-features=AutomationControlled")
doing that is bit complicated all you need to do is 5. Remove JavaScript Signature
I have never tried that
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory

songdg
Posts: 557
Joined: 04 Oct 2017, 20:04

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by songdg » 09 Apr 2023, 02:49

Xeo786 wrote:
23 Nov 2022, 07:29
Full page Screenshot Trick

It's been hard for programmers to capture full-page screenshots, Thanks to CDP Rufaydium just got Session.CaptureFullSizeScreenShot(location) method that can take full page scrolled to the end screenshot! and it's very fast.

The following example needs latest Rufaydium.

Code: Select all

#include Rufaydium.ahk 
chrome:= new Rufaydium()
Session := chrome.NewSession()
Session.Maximize()
Session.url := "https://www.autohotkey.com/boards/viewforum.php?f=6"
location := A_Desktop "\www.autohotkey.com.png"
Session.CaptureFullSizeScreenShot(location)
Session.Quit()
chrome.Driver.Exit()
run, % location
Thanks, I want to take this page https://item.jd.com/100007866995.html as a full-page screenshot, but it dose not work properly, the image has some overlap and missing part.

User avatar
Xeo786
Posts: 759
Joined: 09 Nov 2015, 02:43
Location: Karachi, Pakistan

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by Xeo786 » 10 Apr 2023, 01:17

songdg wrote:
09 Apr 2023, 02:49
Thanks, I want to take this page https://item.jd.com/100007866995.html as a full-page screenshot, but it dose not work properly, the image has some overlap and missing part.
Well thats limit of the browser not the Rufaydium bug, 16384px right after that image starts overlap although you get tha image of actual size of the page. You have to find out how to break that limit or ask browser devs.
Attachments
tempsnip.png
tempsnip.png (110.64 KiB) Viewed 3510 times
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory

darksiderhp
Posts: 3
Joined: 13 Apr 2023, 21:58

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by darksiderhp » 13 Apr 2023, 22:46

Hello Rufaydium team

Rufaydium is truly amazing. I have a problem with putting values into textboxes. The problem is that when I put the value in and press Tab by the 1st way the speed is very fast almost at the same time, but the side information is not loading. When I use the 2nd method or enter manually, the information next to it loads, but I will have a break between each text box so it will take more time. The information will automatically download from the server corresponding to the code entered. I checked and noticed there is a difference in javascript

Can someone help me to use the 1st method but can loaded the information? Thanks for the help. Details as attached photo. Sorry I'm not very good at English
image.png
image.png (529.67 KiB) Viewed 3466 times

User avatar
Xeo786
Posts: 759
Joined: 09 Nov 2015, 02:43
Location: Karachi, Pakistan

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by Xeo786 » 14 Apr 2023, 01:15

all you need to do is find out the culprit event from eventlistners using devtools, and then trigger that event manually using JS, or you can use trick to trigger it

Tricks:
I see you are sening tab aka "`t" it makes focus out so set value and send text both

Code: Select all

Element.Value := "QCI1234567"
Element.SendKey("`t")
OR
Get next element and focus that which will focus out the

Code: Select all

Element.focus()
Element.Value := "QCI1234567"
NextElement.focus() ; quantity element just below 
JS:

Code: Select all

Session.ExecuteSync("some js that will trigger the culpirt event")
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory

songdg
Posts: 557
Joined: 04 Oct 2017, 20:04

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by songdg » 14 Apr 2023, 02:45

Xeo786 wrote:
10 Apr 2023, 01:17
songdg wrote:
09 Apr 2023, 02:49
Thanks, I want to take this page https://item.jd.com/100007866995.html as a full-page screenshot, but it dose not work properly, the image has some overlap and missing part.
Well thats limit of the browser not the Rufaydium bug, 16384px right after that image starts overlap although you get tha image of actual size of the page. You have to find out how to break that limit or ask browser devs.
So there is no solution :roll: , thanks :salute:

darksiderhp
Posts: 3
Joined: 13 Apr 2023, 21:58

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by darksiderhp » 14 Apr 2023, 03:53

Xeo786 wrote:
14 Apr 2023, 01:15
all you need to do is find out the culprit event from eventlistners using devtools, and then trigger that event manually using JS, or you can use trick to trigger it

Tricks:
I see you are sening tab aka "`t" it makes focus out so set value and send text both

Code: Select all

Element.Value := "QCI1234567"
Element.SendKey("`t")
OR
Get next element and focus that which will focus out the

Code: Select all

Element.focus()
Element.Value := "QCI1234567"
NextElement.focus() ; quantity element just below 
JS:

Code: Select all

Session.ExecuteSync("some js that will trigger the culpirt event")
Thank Xeo768. I will try it

JerryMaguire
Posts: 16
Joined: 05 Mar 2023, 11:17

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by JerryMaguire » 21 Apr 2023, 03:42

Image

Step-1 Delete Button click() OK

Step-2 After clicking the delete button, a pop-up window appears, and you need to click the confirm button

Step-3 The confirmation button needs to be clicked, but the focus of the pop-up window cannot be obtained, and the confirmation button cannot be clicked

Xeo786,can you help me?
Thanks

JerryMaguire
Posts: 16
Joined: 05 Mar 2023, 11:17

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by JerryMaguire » 21 Apr 2023, 07:07

@Xeo786

I found a solution to click the confirmation button of the popup window, use Autohotkey's WinExist(WinTitle) to activate the window, use Send {Enter} or Send {Space} to click
confirm button

darksiderhp
Posts: 3
Joined: 13 Apr 2023, 21:58

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by darksiderhp » 22 Apr 2023, 00:01

@Xeo786
I create a new tab in the current session. But when I click on an element it doesn't work. While the old tab still works properly. Where did i go wrong can you tell me?

Crayder
Posts: 7
Joined: 11 Oct 2019, 22:54
Contact:

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by Crayder » 22 Apr 2023, 21:36

Is there a way I can do document.createElement and append the element to the body?

JerryMaguire
Posts: 16
Joined: 05 Mar 2023, 11:17

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by JerryMaguire » 23 Apr 2023, 06:40

@Xeo876

Later I found out that Rufaydium has implemented a method for alerts popup messages, which also works when the browser is minimized

Handling Session alerts popup messages
Session.Alert("GET") ; getting text from pop up msg
Session.Alert("accept") ; pressing OK / accept pop up msg
Session.Alert("dismiss") ; pressing cancel / dismiss pop up msg
Session.Alert("Send","some text") ; sending a Alert / pop up msg

JerryMaguire
Posts: 16
Joined: 05 Mar 2023, 11:17

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by JerryMaguire » 23 Apr 2023, 09:50

JerryMaguire wrote:
21 Apr 2023, 07:07
@Xeo786

I found a solution to click the confirmation button of the popup window, use Autohotkey's WinExist(WinTitle) to activate the window, use Send {Enter} or Send {Space} to click
confirm button
maybe you provide your code for reference

User avatar
Xeo786
Posts: 759
Joined: 09 Nov 2015, 02:43
Location: Karachi, Pakistan

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by Xeo786 » 26 Apr 2023, 01:31

Crayder wrote:
22 Apr 2023, 21:36
Is there a way I can do document.createElement and append the element to the body?
yes, by using Javascript Methods Session.ExecuteSync(JS)
Last edited by Xeo786 on 26 Apr 2023, 01:46, edited 1 time in total.
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory

User avatar
Xeo786
Posts: 759
Joined: 09 Nov 2015, 02:43
Location: Karachi, Pakistan

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by Xeo786 » 26 Apr 2023, 01:42

darksiderhp wrote:
22 Apr 2023, 00:01
@Xeo786
I create a new tab in the current session. But when I click on an element it doesn't work. While the old tab still works properly. Where did i go wrong can you tell me?
Creating tab/window switchs the control by default, but you can also create tab without switching control,

Code: Select all

Session.NewTab(0)
JerryMaguire wrote:
23 Apr 2023, 06:40
Later I found out that Rufaydium has implemented a method for alerts popup messages, which also works when the browser is minimized

Handling Session alerts popup messages
Session.Alert("GET") ; getting text from pop up msg
Session.Alert("accept") ; pressing OK / accept pop up msg
Session.Alert("dismiss") ; pressing cancel / dismiss pop up msg
Session.Alert("Send","some text") ; sending a Alert / pop up msg
Popup messages are also called user prompts, you can also change the behaviour of handle user prompt while creating session see here
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory

Crayder
Posts: 7
Joined: 11 Oct 2019, 22:54
Contact:

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by Crayder » 26 Apr 2023, 09:38

Is there a way to make AHK listen to JS events? That'd be a cool feature I think.

JerryMaguire
Posts: 16
Joined: 05 Mar 2023, 11:17

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by JerryMaguire » 26 Apr 2023, 21:12

@Xeo786

How to close tab?
may you help me,thank you very much

User avatar
Xeo786
Posts: 759
Joined: 09 Nov 2015, 02:43
Location: Karachi, Pakistan

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by Xeo786 » 26 Apr 2023, 23:24

JerryMaguire wrote:
26 Apr 2023, 21:12
@Xeo786

How to close tab?
may you help me,thank you very much
First you have to make sure that tab you want to close is active tab, the tab in contorl. Session.Close() will close that tab, and if that tab is the last tab then session will automatically terminated. just like a user manually closes the last tab.
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory

User avatar
Xeo786
Posts: 759
Joined: 09 Nov 2015, 02:43
Location: Karachi, Pakistan

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by Xeo786 » 26 Apr 2023, 23:35

Crayder wrote:
26 Apr 2023, 09:38
Is there a way to make AHK listen to JS events? That'd be a cool feature I think.
for that you need event Callbacks and that is only possible with websocket connection and there is a branch where I demonstrated how to do that.
Websocket branch look into file 0 test.ahk, you can find all the event from dev tools protocol I am using Inspector.detached in this example.

You can almost achieve anything using devtool protocol events, you have to use Session.executeAsync(), and I just modify it for callback support ExecuteAsync(Script,Callback,Args*), I haven't tried it so I can't say it would work or not.
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory

Jasonosaj
Posts: 50
Joined: 02 Feb 2022, 15:02
Location: California

Re: Rufaydium WebDriver 1.7.2 (no selenium/websocket)

Post by Jasonosaj » 02 May 2023, 12:50

Apologies if this is a ridiculous question. I've been slamming my head against the issue and cannot figure it out, even AFTER searching. If the answer is already in this thread, it's my lack of techinical knowhow that is creating the issue. In any event, I have a website and I want to input text in an edit. The following JS works in the console:

Code: Select all

const input = document.querySelector('input[name="cfDisplay"]');
input.addEventListener("keydown", function(event) {
  if (event.keyCode === 13) {
    event.preventDefault();
    input.value = "your text here";
    document.getElementById("myForm").submit();
  }
});
I have tried a variety of approaches and for the life of me cannot get it to work using Rufaydium. I had THOUGHT that the following would work, but no.

Code: Select all

		JS = 
		(
			const input = document.querySelector('input[name="cfDisplay"]')
		
			input.addEventListener("keydown", function(event) {
			if (event.keyCode === 13) {
				event.preventDefault()
				input.value = "your text here"
				document.getElementById("myForm").submit()
			}
			}
		)
		Session.CDP.Evaluate(js)
Can anyone spot what I'm doing wrong? Unfortunately cannot give access to the page in question...

Post Reply

Return to “Scripts and Functions (v1)”