The only source of knowledge is experience

Testing web apps on Edge using CodedUI

Recently Microsoft added the capability to CodedUI to test on the Edge browser. For this they extended the cross browser playback capability. This uses Selenium under the hood. So the steps to make this work are as follows:

 

  • Install the plugin “Selenium components for Coded UI Cross Browser Testing” from the Visual Studio Gallery (found here)
  • Download the Edge driver that matches your windows 10 version (found here)
  • Install the driver to the following location : %ProgramFiles(x86)%\Microsoft Web Driver

And finally in the code you need to switch the browser you want to launch. You need to provide the following name to start edge:”MicrosoftEdge”

BrowserWindow.CurrentBrowser = “MicrosoftEdge”; 

And that is it!

Happy testing on Edge Smile

11 Comments

  1. Naveen

    Hi MARCEL,

    I followed all the steps that you have specified above. It launches the application successfully, but throws an error “The playback failed to find the control with given search properties” for some controls on edge browser. On the other hand it works fine IE.

  2. Brian Baker

    Thanks for the clue that the correct string is “MicrosoftEdge” and not just “Edge.” Seems like they would have posted that on the VS Marketplace page!

  3. A Haberbosch

    Doesn’t seem to work for me. I’m getting null object error even though the webdriver and an edge window is opening. Any ideas?

  4. Giampiero

    Hi Naveen,

    We got the same problem here. Did you find any solution so far?
    Thanks for your answer.

    Regards, Giampiero

  5. Robert

    Hi Marcel

    We tried to launch the EDGE browser as shown in your example. But we get always an exception “System.NullReferenceException: ‘Object reference not set to an instance of an object.'”, regardless the URL we pass. The WebDriver is started and also the EDGE Browser…
    Our environment: VS2017, Win10, MicrosoftWebDriver matching Win OS version.
    What could be the reason for this?
    Cheers, Robert

  6. Rag

    I am getting this. Value cannot be null.\r\nParameter name: windowHandle”. Below is my sample code:
    BrowserWindow.CurrentBrowser = “MicrosoftEdge”;
    var br = BrowserWindow.Launch(new Uri(login_url));

    I get the Edge browser opened but as soon as opening, I get the exception mentioned above.
    What am I doing wrong?

  7. Gayatri Vijay

    Hi Marcel,

    I have been working on the codedui testing for the Edge browser, I have followed the above steps but it gives me a “System.NullReferenceException” on the line – browserWindow.Launch(new Uri(“”));
    The edge browser is launched but the url is not getting navigated to the browser.
    Could you please help in this.

    Below is the detailed error which I am getting
    Object reference not set to an instance of an object.
    System.NullReferenceException
    at Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser.CrossBrowserService.InitializeTopLevelWindow()
    at Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser.CrossBrowserService.InitializeCrossBrowserService(String[] args)
    at Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser.CrossBrowserService+c.b__3_3(String[] args)
    at Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser.CrossBrowserService.Launch(String[] args)
    at Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser.CrossBrowserFactory.Launch(String[] arguments)
    at Microsoft.VisualStudio.TestTools.UITesting.BrowserWindow.LaunchPrivate(String[] arguments)
    at Microsoft.VisualStudio.TestTools.UITesting.BrowserWindow+c__DisplayClass3_0.b__0()
    at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod(Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
    at Microsoft.VisualStudio.TestTools.UITesting.BrowserWindow.Launch(String[] arguments)

    Thanks in advance

  8. Andrew

    I have tried this but it always dies right after the edge window is invoked with an exception; “Object reference not set to an instance of an object.”
    I don’t have any problems running chromedriver or webdriver so I am puzzled why this is an issue with edge. Any insights?

  9. shreya

    I am facing the same problem. I am getting the error “System.NullReferenceException: ‘Object reference not set to an instance of an object.'” as soon as I the Edge Browser opens up.

    I have tried multiple things, and still facing the error. Does any one know why is this happening?

  10. Krishnan

    In Microsoft Edge browser for record and playback, objects not getting identified and gives a message as: “To test Windows Store apps, use the Coded UI Test project template for Windows Store apps under the Windows Store node.” Could you please help in this!

    • Marcel

      You can not record and playback using edge. Recording is only supported on IE

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2023 Fluentbytes

Theme by Anders NorenUp ↑