1

I am testing gmail login page in CodedUI testing and completed recording all actions.

Now i want to first launch login page of google page and i have implemented code as shown below.

BrowserWindow.CurrentBrowser = "IE";
this.UIMap.UIAdminloginMozillaFirWindow.LaunchUrl(new Uri("https://www.google.com"));

But Error is:

enter image description here

Dinesh Reddy Alla
  • 1,677
  • 9
  • 23
  • 47
  • I see the squiggly line denoting an error, but what is the error? When you hover over the LaunchUrl method, what does Visual Studio tell you? – Ryan Cox Mar 30 '15 at 11:57
  • see my previous [answer](http://stackoverflow.com/questions/29299423/some-elements-take-too-long-to-be-identified-when-playing-your-coded-ui-test/29327640?noredirect=1#comment46886115_29327640) using selenium – lloyd Mar 31 '15 at 01:29

2 Answers2

1

You can use the Selenium components for Coded UI Cross Browser Testing (https://visualstudiogallery.msdn.microsoft.com/11cfc881-f8c9-4f96-b303-a2780156628d), a set of extensions that translate Coded UI calls to WebDriver calls, and hence enabling support for Firefox and Chrome.

Download the installer and run it. If you build your tests using the test recorder, record as usual with Internet Explorer (recording does not work in Firefox or Chrome). In your code, before calling BrowserWindow.Launch("url"), set the browser type as follows:

BrowserWindow.CurrentBrowser = "Firefox"; // or "Chrome" or "IE"

Use almost all of the normal properties and methods of HtmlControl and its descendants. I know from experience that accessing HtmlControl.ControlDefinition will throw a NotSupportedException, and Mouse.StartDragging()/StopDragging() also does not work. Debugging can sometimes be interesting as well.

Michael P
  • 153
  • 9
-1

Add in Selenium for testing in Firefox.

[TestClass]
public class UnitTest1
{
    FirefoxDriver firefox;

    // This is the test to be carried out.
    [TestMethod]
    public void TestMethod1()
    {
        firefox = new FirefoxDriver();
        firefox.Navigate().GoToUrl("http://www.google.com/");
        IWebElement element = firefox.FindElement(By.Id("lst-ib"));
        element.SendKeys("Google\n");
    }

    // This closes the driver down after the test has finished.
    [TestCleanup]
    public void TearDown()
    {
        firefox.Quit();
    }
}
Community
  • 1
  • 1
lloyd
  • 1,683
  • 2
  • 19
  • 23