WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: JTaylor on January 13, 2025, 08:06:56 AM

Title: wbOmniWV2 - Embedded Browser
Post by: JTaylor on January 13, 2025, 08:06:56 AM
I have created a way to embed WebView2 into a Dialog.  Hopefully Tony won't tell me this was already doable via the COM Control :)   Once I do a little more with this with my production stuff and give time for feedback, assuming anyone is interested in giving it a try, I will fold into the main wbOmnibus package.

In any event, it also has DOM access to the browser.  My goal was to have a replacement for Internet Explorer as I used that a lot, and I am reasonably pleased with the results.  The "Test DOM" button only works on the Amazon page to which it browses or, I guess, some other book page on Amazon.

    http://www.jtdata.com/anonymous/wv2_demo.zip

Please read the Help.  It is under the "WebView" section.   There are some quirks.  I included the executable for the demo script due to one of the quirks but, of course, it is always wise to compile your own.

Also, it might be a little slow the first time your run it as WebView2 creates some support structures.

Jim
Title: Re: wbOmniWV2 - Embedded Browser
Post by: spl on January 13, 2025, 08:41:10 AM
Jim graciously allowed me to test privately. It is worth the look.
Title: Re: wbOmniWV2 - Embedded Browser
Post by: JTaylor on January 13, 2025, 08:47:46 AM
I also intended to mention that I am not sure how forgiving the DOM access is regarding poorly formed HTML.  If you have problems you might check that possibility first.


Thanks Stan.  It is a lot prettier now :-)

Jim
Title: Re: wbOmniWV2 - Embedded Browser
Post by: td on January 13, 2025, 09:28:06 AM
Interesting. WebView2 is already on our to-do list. But since the list is long it hasn't been gotten to yet.
Title: Re: wbOmniWV2 - Embedded Browser
Post by: JTaylor on January 13, 2025, 01:55:42 PM
If you know how I could initialize WebView2 without having to compile a script, that would GREATLY appreciated.  Development/Testing is very annoying.

Jim

Quote from: td on January 13, 2025, 09:28:06 AMInteresting. WebView2 is already on our to-do list. But since the list is long it hasn't been gotten to yet.
Title: Re: wbOmniWV2 - Embedded Browser
Post by: JTaylor on January 13, 2025, 01:56:38 PM
Also, if someone downloaded this earlier and you seem to be missing a file, I posted an update to correct that problem.

Sorry.

Jim
Title: Re: wbOmniWV2 - Embedded Browser
Post by: spl on January 14, 2025, 05:42:02 AM
Quote from: JTaylor on January 13, 2025, 01:55:42 PMIf you know how I could initialize WebView2 without having to compile a script, that would GREATLY appreciated.  Development/Testing is very annoying.


Jim, I'll take a discussion of this with you offline to avoid crowding this thread with tangents.
Title: Re: wbOmniWV2 - Embedded Browser
Post by: JTaylor on January 16, 2025, 11:54:58 AM
I posted an update.  Added a few more Functions for DOM features.

    http://www.jtdata.com/anonymous/wv2_demo.zip


Jim
Title: Re: wbOmniWV2 - Embedded Browser
Post by: spl on January 18, 2025, 10:58:42 AM
Attached is a simple test, based on Jim's sample .wbt in the download. I simply copied to a diferent name in the same folder, added a test URL [great for testing web scraping] and modified the code associated with the DOM button at the top of the Window.

But will return a list of Product Names, for current page in about a second. My plan is to collect the:
Product Name
Price
URL
Image

for all products and perhaps for first 10 pages as site is built for pagination. As Jim pointed out it is a little annoying to have to re-compile before testing any code changes/additions.

Hope this might be tested/extended as Jim put a lot of work into the Extender.
Title: Re: wbOmniWV2 - Embedded Browser
Post by: JTaylor on January 18, 2025, 07:34:03 PM
Thanks Stan.   Also, I did post another update last night.  It moves the WebView2 support files to the User's Local AppData folder under the wvWebView2 folder.


http://www.jtdata.com/anonymous/wv2_demo.zip

http://www.jtdata.com/anonymous/wv2_demo_no_edge.zip   -  Excludes WebView2 files for those who have downloaded full zip already.  Drops size by about 260 mb.

May have added some more functions.  Can't remember what I posted previous to this one.

Jim
Title: Re: wbOmniWV2 - Embedded Browser
Post by: JTaylor on January 18, 2025, 07:37:19 PM
Again, if anyone has a solution for avoiding having to compile, I would LOVE to hear it.

jim
Title: Re: wbOmniWV2 - Embedded Browser
Post by: JTaylor on January 23, 2025, 11:25:54 AM
Posted another update. 

Added option to limit wvGetElementsByClass() by tagname.
Added option to retrieve items by name attribute wvGetElementsByName().
Added wvRefreshDOM() for times one might alter web page using wvExecuteScript()

http://www.jtdata.com/anonymous/wv2_demo.zip

http://www.jtdata.com/anonymous/wv2_demo_no_edge.zip   -  Excludes WebView2 files for those who have downloaded full zip already.  Drops size by about 260 mb.
Title: Re: wbOmniWV2 - Embedded Browser
Post by: JTaylor on January 24, 2025, 11:43:14 AM

Posted another update.  This has a breaking change.  Sorry but I think it was a good one.

Added wvGetClasses() to retrieve list of class attributes by element.

Removed wvGetElementsByName() and wvGetElementsById() and replaced with wvGetElementsByAttribute()  -- Realized I could do this and make any Attribute accessible in this fashion rather than just those two.

http://www.jtdata.com/anonymous/wv2_demo.zip

http://www.jtdata.com/anonymous/wv2_demo_no_edge.zip   -  Excludes WebView2 files for those who have downloaded full zip already.  Drops size by about 260 mb.