Chromium WebGadget v4

Developed or developing a new product in PureBasic? Tell the world about it.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,

Thank you for the time you put into testing version 2. Unfortunately, we were unable to figure out the conditions blocking your computer from connecting to DevTools via WebSockets.

I will continue to improve both versions, but unless I trip across something that might solve the problem, I think we've both exhausted enough time and patience trying to find a solution.

---------------------------------

Updated:
- improved Send Request and Send Response
- added some new methods for testing
- numerous other improvements

Send Request and Send Response
Send Request is now an Array; multiple requests can be sent in a single call.
Send Response should return a single message containing the responses to each request.
Last edited by JHPJHP on Sat Jul 09, 2022 8:00 pm, edited 2 times in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Updated:
- numerous updates and improvments

Most of the changes were to version 2; accessing the DOM and executing JavaScript.
Last edited by JHPJHP on Sat Jul 09, 2022 10:43 pm, edited 1 time in total.
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

JHPJHP,

Hello. Using version 1 is possible to detect event in Edge WebGadget, per example title change?

Best Regards
ARGENTINA WORLD CHAMPION
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

ricardo wrote: Thu May 19, 2022 3:41 pm JHPJHP,

Hello. Using version 1 is possible to detect event in Edge WebGadget, per example title change?

Best Regards
What i really need to know is when the browser has navigated by user interaction.
ARGENTINA WORLD CHAMPION
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,

No, not natively, but if it's just a title change event you can always write your own using Threads.

A similar Procedure (CE_WebGadget_Event_JSE) can be found in cewg_sources.pbi.

There doesn't seem to be enough interest for me to spend much more time improving the Chromium Edge WebGadget.
If I have a personal need for something I'll add it, but for now I have other interests needing my attention.

-----------------------------------

Updated:
- various improvements
- squashed a couple bugs

Version 2 now includes all version 1 examples.
CE_WebGadget_Browser.pb will run with or without #CE_WebGadget_Enable_Remote_Connection = #True.

NB*: Free executables (x86/x64) have been updated and can be downloaded from My PureBasic Stuff; see FREE STUFF.
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

JHPJHP wrote: Sat May 21, 2022 4:17 pm Hi ricardo,

No, not natively, but if it's just a title change event you can always write your own using Threads.

A similar Procedure (CE_WebGadget_Event_JSE) can be found in cewg_sources.pbi.

There doesn't seem to be enough interest for me to spend much more time improving the Chromium Edge WebGadget.
If I have a personal need for something I'll add it, but for now I have other interests needing my attention.

-----------------------------------

Updated:
- various improvements
- squashed a couple bugs

Version 2 now includes all version 1 examples.
CE_WebGadget_Browser.pb will run with or without #CE_WebGadget_Enable_Remote_Connection = #True.

NB*: Free executables (x86/x64) have been updated and can be downloaded from My PureBasic Stuff; see FREE STUFF.

Thanks :)
ARGENTINA WORLD CHAMPION
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Updated:
- improved \v2\Remote Examples\CE_WebGadget_Remote_Detail.pb

Enabled event messages for part of the DevTools Protocol.
- #CEWG_Event_Protocol_DOM_Enabled = #True
- #CEWG_Event_Protocol_Network_Enabled = #True
- #CEWG_Event_Protocol_Page_Enabled = #True
- #CEWG_Event_Protocol_Runtime_Enabled = #True

NOTE: Message details can be verbose (i.e. Network Protocol).
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,
JHPJHP wrote:I will continue to improve both versions, but unless I trip across something that might solve the problem...
The following update uses an alternate method to connect to DevTools, and was based on script posted by Netzvamp.

Currently the script is unfinished as it does not support fragmented frames.
I will continue reading the documentation and complete the modifications over time.

After these changes the PureBasic WebSocket script will replace the existing JavaScript method.

-----------------------------------------------

Updated:
- added \v2\Remote Examples\CE_WebGadget_WebSocket_DevTools.pb

CE_WebGadget_WebSocket_DevTools.pb
This is a companion program to CE_WebGadget_Remote_Detail.pb.

1. Run CE_WebGadget_Remote_Detail.pb.
2. Run CE_WebGadget_WebSocket_DevTools.pb.
3. Copy PageID from CE_WebGadget_Remote_Detail.pb. to CE_WebGadget_WebSocket_DevTools.pb.
4. Press the Connect WebSocket DevTools button.
5. Press the Send WebSocket Request button.

The URL in CE_WebGadget_Remote_Detail.pb should change and information should populate CE_WebGadget_WebSocket_DevTools.pb.
Last edited by JHPJHP on Wed Jun 08, 2022 9:19 pm, edited 6 times in total.
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

JHPJHP wrote: Fri Jun 03, 2022 1:20 am Hi ricardo,
Nop.

I do a fast test but it does not work :(
ARGENTINA WORLD CHAMPION
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Updated:
- improved CE_WebGadget_WebSocket_DevTools.pb

CE_WebGadget_WebSocket_DevTools.pb
Rewrote most of the code for better compatibility with DevTools, includes various optimizations and improvements.
Sending and receiving Fragmented Frames (greater than 65535 bytes) is now supported.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Originally, Chromium Edge WebGadget was created to demonstrate how easy it is to include simple but robust (JavaScript, HTML5, CSS3) features into a PureBasic application. After months of continued improvements more complex features were supported.

Over the past few months access to DevTools has been added, providing nearly unrestricted control over the browser.
For those of you unfamiliar with DevTools, open your browser and press the F12 key; most of what you see can be accessed using PureBasic.

See the Chrome DevTools Protocol webpage for available commands.

--------------------------------------------------

Updated:
- improved CE_WebGadget_DevTools_Remote.pb
- some naming convention changes
- squashed a couple bugs

Currently, the improved WebSocket script is being added to the main package; see previous posts for additional information.
Due to these changes CE_WebGadget_DevTools_Detail.pb is only partially working.

CE_WebGadget_DevTools_Remote.pb
Previously this example could only be used as a companion to CE_WebGadget_DevTools_Basic.pb and CE_WebGadget_DevTools_Detail.pb.
With the recent changes the example can now be used as a standalone tool, working with your regular browser.

1. Press the Chromium Edge button.
2. Press the Connect Port button.
3. Press the Connect DevTools button.
4. Press the Send Command button.

As the Chrome DevTools Protocol is quickly becoming the default framework for browsers across OS platforms, CE_WebGadget_DevTools_Remote.pb should only require a few modifications to work in OSX and Linux :?:
Last edited by JHPJHP on Tue Jun 14, 2022 8:15 pm, edited 5 times in total.
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

JHPJHP wrote: Sat Jun 11, 2022 11:48 pm
With the recent changes the example can now be used as a standalone tool, working with your regular browser.

1. Press the Chromium Edge button.
2. Press the Connect Port button.
3. Press the Connect DevTools button.
4. Press the Send Command button.

As Chromium is quickly becoming the default framework for browsers across OS platforms, CE_WebGadget_DevTools_Remote.pb should only require a few modifications to work in OSX and Linux :?:

NB*: Free executables (x86/x64) can be downloaded from My PureBasic Stuff; see FREE STUFF; the following standalone tool has been included.

Image

Questions:

Its possible to pass Javascript commands and scripts using this remote option to control the browser?





AWESOME!!

Image
ARGENTINA WORLD CHAMPION
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,
ricardo wrote:Its possible to pass Javascript commands and scripts using this remote option to control the browser?
Yes, it's possible to pass JavaScript commands to the browser.

There are a couple methods to execute JavaScript, but the following is the simplest.
...
4. Enter Runtime.evaluate in the Protocol Method field.
5. Enter "expression":"new XMLSerializer().serializeToString(document);" in the Method Parameters field.
6. Press the Send Command button.

This should return the entire document serialized into a string; results are returned as JSON.
JavaScript follows the expression parameter, both enclosed in double quotes and separated by a colon.
Expression value is only enclosed in double quotes if the DataType is String; see DevTools Protocol.
Last edited by JHPJHP on Thu Jun 16, 2022 2:35 pm, edited 4 times in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Updated:
- fully integrated the new WebSocket script
- improved CE_WebGadget_DevTools_Remote.pb
- improved CE_WebGadget_DevTools_Detail.pb
- renamed CE_WebGadget_DevTools_Basic.pb to CE_WebGadget_DevTools_Basic_JS.pb
- added CE_WebGadget_DevTools_Basic.pb
- modified CE_WebGadget_Browser.pb

NOTE: CE_WebGadget_DevTools_Detail.pb now includes both the JavaScript and PureBasic methods for accessing WebSockets.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Updated:
- removed v1 (v1 merged into v2)
- improved WebSocket scripts
- added some hyperlinks
- set JSON pretty/tidy
- some name changes
Last edited by JHPJHP on Thu May 25, 2023 1:15 am, edited 2 times in total.
Locked