How to close Specific tab on Edge Browser programmatically?

Copper Contributor

Hi All,

 

We were previously using Internet Explorer and now planning to support Microsoft Edge.

 

We have .NET 4.8 based desktop application that launches Internet explorer and closes it by process Id. But we are not able to achieve the same flow using Microsoft Edge.

We understand that the architecture is different for Internet explorer and Edge. Edge uses a multi-processor architecture and killing the browser/tab instance doesn't work by killing the processId of the window/tab.

 

We need to close a specific tab programmatically (c#). 

Kindly suggest an approach to close specific tab on Edge Browser programmatically.

 

Thanks & Regards, 

Kavitha

 

8 Replies

Hi bro

So i have a problem that When i sigh in to Microsoft teams they want to write my phone number so send me a code but I don’t receive the code massage on my phone number i tried everything but it’s not work 

We do expose tab management functionality through various APIs like Web Driver and extensions, so adding that for your application to call may be one way of achieving that.
Hi josh_bodner,
Thanks for your reply.
Can you please suggest specific web driver/extension that can be used to achieve the functionality for closing a specific tab/window on edge brower programmatically?
Thanks & Regards,
Kavitha
In order to interact with your existing application, this is something that would have to be custom written for your environment.
Hi josh,
Can you please provide links to documentation/sdk for custom development to interact my application (wpf/c#) with Edge Browser for tab management functionality?
Thanks & Regards,
Kavitha
Sure, you can use the public Chromium extension documentation at https://developer.chrome.com/docs/extensions/mv3/getstarted/ and https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension if you want to go the extension route.

If you want to use web driver, you can use our documentation at https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/?tabs=c-sharp or the official Web Driver documentation at https://www.selenium.dev/documentation/webdriver/getting_started/.
Hi Josh,
Thanks for the details.
Since we can't install extensions on all the PCs and thinking about its limitations, we would like to explore on the web driver option. Selenium webdriver framework is mentioned in the documentation. How safe and secure is Selenium for Production environment?
Is it possible to create my own WebDriver Testing Framework to communicate with Microsoft Edge?
Thanks and Regards,
Kavitha

@kavithamsse We are also having similar requirement. Could you please let me know if you got any working solution for this requirement.

Thanks in Advance

 

Sudhakar