Monday 9 July 2012

how to Detect Internet explorer Version on Windows

 public void CheckBrowserVersion()
        {
            WebBrowser wb = new WebBrowser();
            Login login = CreateLoginObject();

            if (wb.Version.Major == ie8)
            {
               DO something();
            }
            else if (wb.Version.Major == ie9)
            {
                Do Something();
            }
            else
            {
                Console.WriteLine("UnSupported Browser version");
            }
        }

Friday 1 June 2012

Error Running Build service as "Interactive ", however running as window service it worked Fine

Problem:

Error Running Build service as "Interactive ", however running as window service it worked Fine

1- Error
*******************************************************************
Named pipe communication failure:

Build service will continue but the Administration console will not be able to reach it.
*********************************************************************
 2- Error 
*********************************************************************
Http communication failure: 

Build service will be stopped
********************************************************************
3 - Error 
********************************************************************
Build Service received Stop command and will be stopped. Details: Could not open http channel
*******************************************************************

Solution:

there is no Solution so Far only workaround is to Run it as Service and thats what Microsoft recomends as well

Object reference not set error message when i try to add Taginstance in Filter properties of a control

Problem:

I did a recording of the control then i open its filter properties and removed all information. then i open it search properties and try to add Taginstance in it search property and i got an Error "object reference not set to an instance on an object " and VS quits after this ?

Solution:
  1. delete tag instance from filter properties
  2. save it 
  3. add tag instance in search properties (it will throw exception and Exit VS  that's fine
  4. re-open that file and go to search properties and Add Tag instance now it will add without exception

parameterising a form with text and dropdown controls:

 Scenario:

I have a form that have 2 text boxes and one drop down with 6 values to select from, I have parameterise the text boxes to take values from a CSV file but how can i do this for a dropdown

 solution:

you can try the following way :


         //Method to select item
        public void SelectItem1(string Item)
        {
            #region Variable Declarations
            HtmlComboBox uIItemComboBox = this.UIDellTheOfficialSiteDWindow.UIDellTheOfficialSiteDDocument.UISelfrmCustom.UIItemComboBox;
            #endregion
            // Select 'Japan' in 'Unknown Name' combo box
            uIItemComboBox.SelectedItem = Item;
        }

Calling this in your CodedUITest1.cs  like
             string Item = TestContext.DataRow["Item"].ToString();              this.UIMap.SelectItem1(Item);

This is a small example to select the dropdown item from the CSV file, You can tweak it as per your requirement.