Selenium components for Coded UI Cross Browser Testing

Free

Selenium components for Coded UI Cross Browser Testing

(8) Review
Visual Studio
2013, 2012
Download (18,276)
1/31/2014
1.4
E-mail Twitter del.icio.us Digg Facebook
Add to favorites
Description
Reviews (8)
Q and A (89)
Sign in to write a review
Sort by:

by Srikar Garrepally | at 9:15 AM

complete information not provided regarding pre-requisites and after installing .msi file already chrome driver exists in the specified folder

by Jian_H | December 23 2013

by tiny apps | October 31 2013


Hi this seems to be a nice replacement for the Feature pack2 back in Vs2010 which just support Firefox 3.6 but this is great start to playback CUIT stuff against WebDrive whihc i think eliminates the burning issues open Desktop session

by Oleg Pantsjoha | May 24 2013

Great add on to Coded UI Testing framework, but unfortunately it seems there are still a lot of issues surrounding it, and lack of support is not helping. Some issue and confusion I've spotted from other users while browsing for solutions with my own issues is with simple installation of the product. Additionally, the version support for different browser is all over the place. I understand that it is also down to individual browser suppliers but i believe issue like those should be dealt prior to release of any product. Overall still a great add on, just requires attention to above issue in order to get 5 stars from users. Looking forward to next update.

by JoeH250 | April 30 2013

You really might want to point folks to a sample or two about making use of this functionality. Without some kind of working example that customers can work with, it's really not going to gain any traction.

For those curious about being able to swap between browsers at will, it turns out you need to set an environment variable in order to do that. I found some now out-of-date material at http://msdn.microsoft.com/en-us/library/jj835758.aspx that has a bit of detail on that.

Overall, this is an improvement over being able to run only on IE, but the amount of work that is needed to do so can be time consuming. For example - if you have anything dynamic on your pages (say, part of the window title changes based on a previous action), you're not going to have a great deal of luck using this.

Also, having to code your own "WaitForAjax" solution is a big hurdle to clear.

Based on what I see so far, my team will be staying with our current Selenium WebDriver framework. We have more control over flow, control detection and selection, and dynamic content handling than CUI has.

Fantastic tool!!!

by Marc Velasco | January 10 2013

Have this working with IE, FireFox, and Chrome browsers on a product using a javascript framework. Depending on your application you might need to spend some time creating a good set of search criteria that gives good performance and reliably finds objects across browsers, in my case many of my properties were dynamic across different builds, sessions, and browser because of the javascript framework being used, but we got it working with some experimentation.

by Nathan.Grant | November 30 2012

Install wouldn't work on my Machine - claimed I didn't have Visual Studio 2012 installed but I have legit Ultimate 2012 + the update running. Had to use manual steps.

Sign in to start a discussion


  • Can latest Chrome version 37 supported
    8 Posts | Last post 11:17 AM
    • my codedui VSTS 2013 test is failed with error - failed to identify the object however the object is present in the application. i seen this issue in Chrome 37. 
      
      Chrome browser is upgrading day by day. so if tool is not supported up to the latest version, no point of testing cross browser testing in old browsers.
      
      we have requirements to test our application with latest available browsers. i feel VSTS should support up to latest available browser every time.
      
    • Are you using the Test Builder to define your object or are you creating the object in code?  If you haven't already, check that the browser window is defined properly (There may be a reference to "IEFrame" as a search property in your designer or Window class) as this would cause the object to fail in Chrome.  Just something I've found.
    • You are correct "IEFrame" is available, but when i remove that property my solution got failed with browserWindow does not contain definition for 'Refresh' and no extension method 'Refresh' accepting a first argument. and 'Refresh'is used 173 times in my entire solution.
    • OK, so the definition to your browser window should look something like this:
      
      BrowserWindow myBrowser = new BrowserWindow();
      myBrowser.SearchProperties["Title"] = <title of your site, or something else that fits>;
      return myBrowser;
      
      That should be enough to identify it.  If the myBrowser.Refresh() isn't an available method for the object, it seems like you're not creating a BrowserWindow object.
    • thanks
      the suggested approach i could not able to use because i am using browser object from UIMap. it is quite difficult to update all the UIMap references with the approach suggested by you.  
    • Even if you used the Test Builder to create your maps, you can still edit the windows' properties by editing the search properties collection.  With your .uitest file open, click on the window in question and hit F4 to open the properties pane, and then click the ellipsis in the cell for Search Properties.
      
      Hope this helps.  -R
    • Thanks RyanCox,
      
      with help of your comments, i drill down properties available in the UIMap and found it has non required properties like TagName,ControlDefinition,TagInstance. after removal of those properties, codedUI started working
      
      
      after that i was blocked at one point , in IE a control is identified as Html.Custom but it seems in chrome it is identified as html.hyperlink (I could not able to find exact name of the object using CodedUI test builder because codedUI test builder is not working with chrome).
      
      
      HTMLControls.HtmlHyperlink oCustom_1 = new HTMLControls.HtmlHyperlink(this.UIMap.UI_MainWindow_AVEVANETDashboard.UI_MainDocument_AVEVANETDashboard);             
      oCustom_1.SearchProperties.Add("InnerText", "Actions...", PropertyExpressionOperator.Contains);
      UITestControlCollection uic = oCustom_1.FindMatchingControls();  // 2 items are retrived here, fter that error shown below is displayed
      
      foreach (HTMLControls.HtmlHyperlink oCustom_2 in uic)
       {
      if (oCustom_2.BoundingRectangle.Width > 0)
         {
      
           Mouse.Click(oCustom_1);
           break;
          }
      }
      
      element not visible (Session info: chrome=38.0.2125.24) (Driver info: chromedriver=2.8.241075,platform=Windows NT 6.1 SP1 x86_64)
      
    • Typo in the code, corrected now. started working fine.
  • Failed to click on visible object
    1 Posts | Last post 9:51 AM
    • hi,
      
      While clicking the visible hyperlink object "OpenQA.Selenium.ElementNotVisibleException" error is displayed.
      
      
      {"element not visible\n  (Session info: chrome=38.0.2125.24)\n  (Driver info: chromedriver=2.8.241075,platform=Windows NT 6.1 SP1 x86_64)"}
      
      
      Stack Trace:
         at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) in c:\Projects\WebDriver\trunk\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 1005
         at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in c:\Projects\WebDriver\trunk\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 846
         at OpenQA.Selenium.Remote.RemoteWebDriver.InternalExecute(String driverCommandToExecute, Dictionary`2 parameters) in c:\Projects\WebDriver\trunk\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 729
         at OpenQA.Selenium.Remote.RemoteWebElement.Execute(String commandToExecute, Dictionary`2 parameters) in c:\Projects\WebDriver\trunk\dotnet\src\webdriver\Remote\RemoteWebElement.cs:line 810
         at OpenQA.Selenium.Remote.RemoteWebElement.Click() in c:\Projects\WebDriver\trunk\dotnet\src\webdriver\Remote\RemoteWebElement.cs:line 336
         at Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowserProxy.ProxyWebElement.<Click>b__d()
         at Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowserProxy.FuncInvoker.InvokeMethodSwitchingToContext[T](Func`1 function, ProxyWebElement webElement)
      
      
  • Is it Possible to use CodedUI test Builder with Chrome browser
    1 Posts | Last post 9:47 AM
    • Hi,
      
      i could not able to use CodedUI test builder with Chrome browser . i am looking only for seeing the properties of the object to confirm type of the application object, hyper link or custom control etc
  • Firefox finds the wrong control
    2 Posts | Last post August 21, 2014
    • Working in VS2013, Firefox 26.  I define an HtmlHyperlink:
          HtmlHyperlink target = new HtmlHyperlink(browser);
          target.SearchProperties["class"] = "sizeOptionElement";
          target.SearchProperties["title"] = "Choose size M";
      
      When I `Mouse.Click(target);`, the agent clicks on some other part of the screen instead of the control I've defined.  When I try to highlight the control using `target.DrawHighlight();`, it draws a box around some seemingly random section of the page.  
      
      I am very confused.  This works fine in Chrome 36 and IE11.  Any help is appreciated.
      
      -Ryan
    • I upgraded to Firefox 31 and the WebDriver can now find the control successfully.
  • Some functionality is broken after upgrading Chrome to ver. 36
    6 Posts | Last post August 21, 2014
    • Hi,
      Don't know where to open bug, so I'll report it here:
      After upgrading chrome to version 36.xxx, our CodedUI tests stopped working.
      Here is the error message reported by Selenium Component:
      
      Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties. Additional Details: 
      TechnologyName:  'MSAA'
      ControlType:  'Document'
       ---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
      
      The same code works perfectly with IE8/8/10, Firefox (all versions) and Chrome 35.xxx.
      
      I still can get my code working by:
      1. Setting EqtTraceLevel to 0 (currently it is 4) in application configuration file.
      2. Avoid accessing BoundingRectangle property of UITestControl (it always fails with the above message on Chrome 36 for every control).
      But this would break many of our tests.
      
      Any help would be appreciated.
      Thanks.
    • Hi Igor,
      Can you try performing a browser refresh before accessing these properties. This is a known issue and we are working on it.
      
      - Abhitej.
    • Hi there, I'm experiencing the same exception ("Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties.") when calling Mouse.Click() in Chrome 36. I assume this is because Mouse.Click() depends on the BoundingRectangle. Refreshing the page via BrowserWindow.Refresh() prior to making the call to Mouse.Click() has no effect, the exception still fires.
      
      Stack trace:
      Test Name:	SevereFishhookInEye
      Test Outcome:	Failed
      Result Message:	
      Test method TrainingExercise.CodedUITests.SymptomCheckerTests.SevereFishhookInEye threw exception: 
      Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties. Additional Details: 
      TechnologyName:  'MSAA'
      ControlType:  'Document'
       ---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
      
      Funny thing, though, further down the trace I can see the lines:
      V, 5784, 14, 2014/08/08, 15:17:48.768, 21398635847, QTAgent32, CrossBrowserPlugin : Search : Trying out search using FindElementsBy
      V, 5784, 14, 2014/08/08, 15:17:48.802, 21398719599, QTAgent32, PERF: CrossBrowserPlugin: CreateCrossBrowserElementInstanceWithoutInitialize.: took 3.0662 ms
      V, 5784, 14, 2014/08/08, 15:17:48.805, 21398727645, QTAgent32, CrossBrowserPlugin: Search: Element matched other search properties.
      V, 5784, 14, 2014/08/08, 15:17:48.808, 21398735348, QTAgent32, PERF: CrossBrowserPlugin: AddXPathToElements: took 0.0078 ms
      I, 5784, 14, 2014/08/08, 15:17:48.809, 21398738518, QTAgent32, CrossBrowserPlugin : Search Successful
      V, 5784, 14, 2014/08/08, 15:17:48.809, 21398738704, QTAgent32, PERF: crossBrowserTestPlugin: Search: took 57.9079 ms
      
      So it looks like Chrome is actually finding the element selected, but the COM component isn't getting what it expects to be returned.
    • I am having the same issue getting the .Top property of my control. The control exists. Any updates on a fix/workaround for this issue?
    • Hi Eduardo and Aaron, 
      We do not have an ETA for the fix yet. 
      As a work-around, before accessing any control on the page, try refreshing the page with-
      
      Keyboard.SendKeys("{F5}");
      Playback.Wait(2000);
      
      We have tested this and it works-around the issue for us.
      
      -Vaibhav
      
    • Thanks for getting back to us Vaibhav. Unfortunately for us that work around wont work because the page were we get the issue is a form and a page refresh causes a confirmation to leave or stay in the page and other unexpected behavior with form values also take place. But maybe we can figure something out to don't need to get coordinates.
      
      The reason we ended up trying to get coordinates is because the inconsistency we observed with mouse.clicks and hovers when the control is off screen. It would work on some machines and not in others; even it would work sometimes and not others.
      
  • Cross Browser Testing Issue
    3 Posts | Last post August 15, 2014
    • HI All,
      
      I am doing the cross browser testing using Coded UI. My requirement is to execute the Coded UI Test scripts on Firefox and Chrome browser. I have done all the steps required for cross browsing mentioned below :
      
      1. Downloaded the selenium component for cross browser testing.
      
      2. Copy the net40 folder files to the C:\Program Files (x86)\Common Files\microsoft shared\VSTT\Cross Browser Selenium Components folder.
      
      3. Include the name space Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser
      
      4. Implemented the code : 
      
      BrowserWindow.CurrentBrowser = "Firefox";
       BrowserWindow bw = BrowserWindow.Launch(new System.Uri("www.google.com"));
                     
      
      When I execute the test both in debug or run mode, the script got stuck at second point during launch of Firefox. When I look into Task manager, the firefox.exe*32 process is running. When I close the process then automatically test started running opening a new instance. (Before running the script there is no firefox process running in task manager)
      
      
      Please Help if I m missing any step. Also I am using Visual Studio 2013 Premium edition and Firefox version 29.0.1.
      
      Thanks,
      
      Jatinder Kaur
      
    • Hi Jatinder,
      For firefox tests please close all instances of the firefox browser before playback. Have you installed the MSI? What version of selenium components are you using?
      
      - Abhitej.
    • Hi Jatinder:  To add to Abhitej_MSFT's reply, sometimes a plugin or add-on for firefox will keep a process running in the background, which prevents the Coded UI from launching the browser.  I solved this by disabling the Java Dev toolkit and including in my closeBrowser() method a command to kill any existing firefox processes.  I found this link (https://support.mozilla.org/en-US/questions/817014) to be useful.  
      
      Hope this helps.
      -Ryan
  • Cross browser with Chrome - Browser closed automatically
    13 Posts | Last post August 08, 2014
    • I am trying to cross browser testing with Chrome. Installed the Chrome driver.
      Use below code in my test method.
      BrowserWindow.CurrentBrowser = "Chrome";
      When run the test, it jusy invoke my URL in chrome and get close without executing next test steps. This works in IE.
      
      Can any one let me know the solution, any Driver / browser version combination I need to use ?
    • Hi Patilsudhir,
      Are you running your test as an admin? There is a known issue with navigating in chrome opened as admin process. Can you please run it as a normal user and try. You would be getting  a "Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: The HTTP request to the remote WebDriver server for URL http://localhost:58679/session/c03c325820e1295c76eb5ca2318921e4/title timed out after 60 seconds" in this case.
      If this is not the case what is the version of chrome you are using? Are you able to run the same test on firefox?
      
      -Abhitej.
    • @cra2y80y--
      The current version of the plugin is working with Firefox as well, we have verified that and have hence not updated a newer version of the plugin. Please ensure that you have the latest version of the selenium binaries as well.
      
    • Hi Abhijee
    • Hi Abhijeet I ahave tried without Admin also. Still same issue.
      I amusing Chrome version - 35.0, Chrome driver version as v2.8.241075.
      I amgetting error as Exception caught: Could not locate the browser window, window name not specified.
      
      I am facing same issue with firefox too.
    • Patilsudhir,
      Your generated code seems to have a locate for a launch. Can you paste the code you are using to test here. Also can you make sure that all instances of chrome are closed before running the test.
      Parallely can you just perform a simple launch and navigate and let us know if that is working:
      BrowserWindow.CurrentBrowser = "chrome";
      BrowserWindow window = BrowserWindow.Launch("http://www.bing.com");
      window.NavigateToUrl(new Uri("http://www.microsoft.com"));
      It works for us with the same chrome driver and chrome version : 35.0.1916.153 m.
      
    • Hi Abhijeet
      I have tried with your code for chrome, it first open the command window saying Starting chromedriver, 
      Before inserting the url for bing.com , I observe data:, in the url text.
      also see, text in chrome as ' you are using unsupported command inne flag--ignore certificate error.Stability and security wil suffer.
      Later it navigate to microsoft.com
      but then it gives chromedriver.exe has stopped working.
      
      For Firefox everything works fine.
    • Hi Abhijeet regarding the Chrome driver stopping, it appears sometime.
      Regarding my Code pls see below code. I am using hand coding in which I am passing the property values in the coded it self.
      
      Below is my TestMethod
      public void VerifyCommonLandingPage()
              {
                  string filePath = ConfigurationManager.AppSettings.Get("TestDataPath") + "CommonLandingPageData.csv";
                  string siteUri = ConfigurationManager.AppSettings.Get("OceanSiteUri");
                  string[] linkName = commonObj.ReadFromCsvFiles(filePath, 0, 1);
                  string[] redirectedPageTitle = commonObj.ReadFromCsvFiles(filePath, 0, 2);
      
                  BrowserWindow.CurrentBrowser = "chrome";
                  commonObj.LaunchBrowser(siteUri);
                  for (int i = 0; i < linkName.Length; i++)
                  {
                      commonObj.VerifyLinks("Home", "Home", linkName[i]);
      }
      In this I am verifying the links present on the page. The link name I am passing from excel.
      
      Regarding my actual VerifyLinks method its taking three parameters, browser Name, Document name and the Link name to verify.
      
      Pls see below coded for VerifyLinks method 
      
      
      
                                     
    • Hi Abhijeet any hine.
      Below is my actual Test method which I have written by handcoding.
      
      public void VerifyLinks(string browserName, string docFriendlyName, string linkName)
              {
                  BrowserWindow browser = SetBrowser(browserName);
                  browser.SetFocus();
      
                  HtmlDocument hDoc = SetDoc(docFriendlyName, browser);
                  hDoc.SetFocus();
      
                  HtmlControl hControl = new HtmlControl(hDoc);
                  hControl.TechnologyName = "Web";
                  hControl.SearchProperties.Add("ControlType", "Hyperlink");
      
                  UITestControlCollection collection = hControl.FindMatchingControls();
                  int count = 0;
                  foreach (UITestControl links in collection)
                  {
                      HtmlHyperlink hLink = (HtmlHyperlink)links;
                      if (string.Equals(linkName, hLink.InnerText))
                      {
                          Mouse.Click(hLink);
                          count++;
                          break;
                      }
                  }
                  if (count != 1)
                      Assert.Fail("Failed to find the given link on this page");
              }
    • Patilsudhir,
      The issue with chromedriver is a known issue and I would really encourage you to report this on their webpage: https://code.google.com/p/selenium/wiki/ChromeDriver. What we noticed with this is it happens fairly often during the first few runs but reduces thereafter. Meanwhile we will investigate this further to see if we can fix anything at our end.
      
      -Abhitej.
      
    • Hi Abhijeet we have resolved the issue. The issue is with browser.Setfocus().browser object is of MSAA technology type and setfocus() doesnot works with MSAA technology type. We have removed this and it works.WE have tested it for few methods and working well. For few method may be we need to chnage the object properties.But need a unique method which should work for any browser type. Any way our major issue get resolved.Thanks Abhijet for valuable support.
    • Me too facing the same issue. 
      As per my observation, My web page is not loading fully.
      Are there any way to increase the web driver http request timeout. By default it is 30 sec. If we are able to set it through our c# scripts, it will be very helpful.
    • Hi Ravi,
      
      Apologies for delayed response.
      I think you are looking for PlaybackSettings.WaitForReadyTimeout
      
      Please refer to blog below for details:
      http://blogs.msdn.com/b/gautamg/archive/2010/02/12/how-to-make-playback-wait-for-certain-event.aspx
      
      Thanks, Sarabjot.
  • Unable to execute Java Script (ExecuteScript) in chrome
    2 Posts | Last post August 08, 2014
    • I have used browserwindow.ExecuteScript() in code that used to run in IE 9
      But when i am running in chrome i get a strange result
      In the middle of the run when executing the execute script a pop up opens searching for WebDriverCommandProcessor.cs inside my Test Methods folder.
    • Hi Nikhil, 
      Can you please help me understand what is that your script does ?
      It would be great if you could share a repro or simply paste your script.
      
      Thanks, Sarabjot.
  • Chrome Control location issue
    7 Posts | Last post August 06, 2014
    • Hi,
      I have an issue to find a control location after scrolling in Browser Window when using Chrome Browser. It seems that in IE and FF control coordinate are always relative to the Windows Desktop while in Chrome these are relative to Browser Document window. In addition, when I scroll inside Chrome browser, the location point of the document window doesn't change. Therefore Chrome always returns the same BoundingRectangle for a control no matter what is the current position of the control.
      Is there any workaround for this issue?
      
      Thanks.
    • I'm using VS 2012 + Chrome 30.
    • Hi Igor,
      Sorry for the delay in response. Yes, I was able to repro this. May I know what your scenario is? This is what the chrome driver returns today. Based on the scenario we can think of a workaround to help out. 
    • Hi Abhitej,
      Thanks for your response.
      My scenario implements workaround for another issue (not related to Selenium Component). The SUT is built using jQWidgets library. The library implements large number of custom controls (grids, tables, dropdown boxes, etc.). Pretty much every custom control is constructed using DIV and SPAN html elements only with large portions of javascript code which handles user interactions with the controls. Even scrollbars inside grids or scrollable boxes are implemented with DIV elements only. Therefore CUIT method EnsureClickable()does not work when I need to scroll inside such control to get to specific item. My workaround is to place mouse cursor over such control and then use MoveScrollWheel() method to scroll to a specefic item. Unfortunately it doesn't work with Chrome because I'm not able to get a real control coordinate if document page has been scrolled.
      Any help you can give will be greatly appreciated.
      Here is link to jQWidgets library with a lot of examples:
      http://www.jqwidgets.com/
    • Thanks for you patience Igor. Let me get back with a possible workaround here. Meanwhile Is there a public site that we try this scenario on?
      
      -Abhitej
    • Hi Abhitej,
      
      There are a lot of samples on the developer's site. Here are examples of grid control (you can actually select one from the menu on the left side):
      http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm#demos/jqxgrid/
      
      Thanks.
      Igor.
      
    • Hi Igor,
      The workaround here is to use BrowserWindow.ExecuteScript() to use javascript functionality in scrolling the element into view.
      
      - Abhitej.
  • stale element reference: element is not attached to the page document error is coming when i try to debug in chrome browser
    4 Posts | Last post August 03, 2014
    • I am using Visual Studio 2013
      
      I have installed selenium components for cross browser testing
      
      I am Running the script in Chrome Browser
      
      When I Run the script it is working Fine
      
      But when i try to Debug the script, When execution comes to the line which executes javascript in browser - below error is displaying.
      
      Below is the java script line where  Error is coming
      
      
      string text = "$('.cell-link').each( function(){ if($(this).text() === '" + testName + "') $(this).parent().parent().parent().trigger('click'); });";
      bw.ExecuteScript(text, "javascript");
      
      
      testname is some variable which takes string as input
      
      
      Error:
      
      "stale element reference: element is not attached to the page document\n  (Session info: chrome=35.0.1916.153)\n  (Driver info: chromedriver=2.8.241075,platform=Windows NT 6.1 SP1 x86_64)"
    • Apologies for the delay in response siddhu. Can I ask what you are debugging through? Are you saying the Coded UI Test playback fails when you instead of running, debug the test? 
    • Yes. I am facing problem when i am debugging the test. it is working fine if i RUN the test
      
    • Hi Siddhu,
      This usually happens when there is a refresh or there was a navigation away from the page containing ".cell-link" as detailed here:  http://docs.seleniumhq.org/exceptions/stale_element_reference.jsp. If this does not help can you please point us to a repro page and detail what chrome driver and chrome version you are using?
      
      - Abhitej.
1 - 10 of 89 Items