Get already opened Edge (not IE) browser window(s) and scrape contents - excel

I used to be able to find all open IE windows via VBA and was able to access one of the already-opened page's contents in Excel with the objShell object mechanism. I didn't--and don't need--direct "control" (automation) of the browser in terms of pushing buttons, opening urls, etc.
I know automation of Edge is not possible just using VBA, but is there any ability to simply 1.) get a list of MS EDGE open windows and 2.) retrieve the elements within a given (already opened) window without resorting to downloading drivers and utilities like Selenium?

As Tim Williams had informed you there is no COM interface available for the Edge browser.
Microsoft has not provided any way to automate the Edge browser using VBA automation.
So, there is no way to fetch the already opened instance of the Edge browser and retrieve elements with the help of VBA.
I suggest you use the officially recommended way Selenium Web Driver to automate the Edge browser.
I have seen that you want to avoid the Selenium Web Driver approach but at present, this is the only way available to automate the Edge browser.
If you are having any issues with the Selenium Web Driver approach then you can inform us about it. We can try to provide suggestions for it.
Thanks for your understanding.

Please note: I'm the author of this software
You can connect to active instances of Edge with IE mode using Internet Controls for Edge: https://pomio.dk/internet-controls-for-edge/.
Internet Controls for Edge is a COM component and it exposes the same APIs as Microsoft Internet Controls (for Internet Explorer), so if you've already created some automations of Internet Explorer (using Microsoft Internet Controls), then it should be straight forward to move to Internet Controls for Edge.

Related

How Can I Use Selenium in Excel Without SeleniumBasic?

I created a tool on the job using Excel, VBA and SeleniumBasic to drive Chrome or Edge to go to a company web page and enter some data. The tool works well, but when I requested that it be distributed to a wider audience, I was told that although Selenium is approved for use on company networks, SeleniumBasic is not.
So my question is, is it possible/easy to drive Selenium directly with VBA and avoid having to use SeleniumBasic? The approval process for FOSS is not easy and would take too long, so I think I have to find a workaround.

Relatve URL in distant file (XLS)

I have a problem at my job.
I am totally dependent on a website which must certainly date from the eighties ...
In one of the web pages, there is a link to download an excel file (xls). Let's say for example http://example.excel.xls
In this file, there are hyperlinks to other files (sometimes i think the death penalty is a good thing! ^^).
These links are relative :'( (for example \myfile.pdf)
Internet explorer, strangely, are correcting these links by transforming them in absolute path (http://example.myfile.pdf)
Other browsers (chrome, firefox, even the old edge) don't do it natively. By clicking on the link, we arrive in the local cache, where of course there arenot my files ...
I will soon have to remove IE from computers.
I had considered sending a bombshell on the administrators of this website, but afraid of legal repercussions :)
Is it possible, via settings, an addon or whatever, to make one of the browsers behave in the same way as IE?
I am very grateful for the help you will give me
You had asked,"Is it possible, via settings, an addon or whatever, to make one of the browsers behave in the same way as IE?"
I suggest you make a test with the MS Edge (Chromium) browser.
The MS Edge (Chromium) browser comes with the IE mode feature.
IE mode on Microsoft Edge makes it easy to use all of the sites your organization needs in a single browser. It uses the integrated Chromium engine for modern sites, and it uses the Trident MSHTML engine from Internet Explorer 11 (IE11) for legacy sites.
To configure IE mode, I suggest you refer to Configure IE mode policies. You can refer to the document and configure the necessary policies to enable the IE mode.
It can help you to load your legacy site in the Edge browser using the IE mode which can help you to fix the said issue.

Upgrading From IE to EDGE

I need VBA Code translation for Edge.
I’m in a Window10/Excel 16 environment. I have been using Internet Explorer (IE) when I scrape data from websites.
Now, I am needing to upgrade to Microsoft Edge. I am having to translate some code and I am finding I need some help.
I used to call the URL https://www.azblue.com/individualsandfamilies/ using “IE.navigate”. Ex:
IE.navigate "https://www.azblue.com/individualsandfamilies/"
But, what I cannot figure out is how to use these other lines of Code with Edge. Here are a 3 lines of code (disjointed) that I use often and need to know the syntax translation for Edge:
IE.document.getElementById("lockedcontent_0_maincolumn_2_twocolumn2fb4d204091d44aa08196ef423877fd9f_0_ToolbarUsernameControl").Focus
IE.document.getElementById("lockedcontent_0_maincolumn_2_twocolumn2fb4d204091d44aa08196ef423877fd9f_0_ToolbarUsernameControl").Value = "MyUserName"
IE.document.Focus
Of course, any help is greatly appreciated
Thanks!
Microsoft Edge browser doesn't support the COM automation interface that used in VBA. If you want to automate Microsoft Edge, you should use WebDriver.
To get started using WebDriver, you will need to download a testing framework of your choice along with an appropriate language binding and the MicrosoftWebDriver server.
We usually use Selenium and you could download the language binding in this page. At the same time, you could download Microsof Edge WebDriver in this page.
Reference link: Will Microsoft Edge support COM automation (InternetExplorer object)?

How to control "Browser mode" in Internet Explorer 9 by commandline

I still haven't been able to find a solution to this problem. We have an application that launches a browser window but the underlying third party addin that we are using doesn't support IE9 yet. I know that I can switch to Browser mode for IE8 by tapping F12 and select this.
Is there a way to control this on the startup in the command line? Cause as it is now we have problem when running the application when it opens new windows and automatically tries to execute this third party addin that is required.
And no we haven't an option, we are forced to use this third party addin but would like to support that installation of IE9 as well.
I don't know if you have any control over the content being rendered in the browser, but if you do, IE lets you use META tags to force the browser into a rendering mode of a specific IE version. More info at MSDN right here
Also, further down the page there are instructions on how to set up your web server to tell IE which mode to use when it's requesting the page. (If that is of any use to you)
Unfortunately all information I can find on the subject (and I did a comprehensive search for my own project) indicates that there is no such option, or at least not in the general release
of IE.
Here's Microsoft's "official"
list of currently supported IE command line options

word document viewer browser plugin

Is there a browser plugin or an extension that allows the user to view .doc files in browser?
I need to embed in my application, a document viewer. So far, I tried using services like google docs, but this solution doesn't work for our application, because of some security problems.
Do you know about the Office Web Apps? Microsoft developed something similar to Google Docs and you can use the Word Web Application to view Word files. It will pretty much display anything - a lot of editing functions from the offline version are not available though.
If you are just looking for a viewer search for "Word ActiveX Viewer" and you will find plenty (commercial) viewers.
To have IE open the .doc within the browser and not in a separate winword.exe, you need to define the association at client end.
As .doc file is an external resource to HTML, it would download the file into its temp, and then attempt to launch it. It would launch it using the default program that it is associated with.
To control this behavior, please have a look at:
http://www.shaunakelly.com/word/sharing/opendocinie.html
I thought Internet Explorer + Microsoft Office used to do this by default?
I can for sure tell you that other than converting the doc to html you won't get a cross-browser, cross-platform solution.
Since you are saying it's for viewing only, that would seem like the way to go.

Resources