locked
Typical HTMLHyperLink object determines as HTMLCustom in CodedUI

    Question

  • Typical HTMLHyperLink object determines as HTMLCustom in CodedUI.

    I have next HTMLObject (Hyperlink) that is determining as HTMLCustom by CodedUi framework. its not possible to find it as HTMLHyperLink:

    <Atitle="add security code"onclick="addInstrumentType();"><SPAN class="button-left">&nbsp;</SPAN><SPAN class="button-body">add</SPAN><SPAN class="button-right">&nbsp;</SPAN></A>
    Is this an Mircosoft issue? anybody know? Why typical HYperlink contol is determining as common HTMLCustom control? <A> is a typical HTMLTag!!!!!!!!!!

    Also there is an other control that is determining in right way. The only difference with control above is a presence of href property. But both are still HTMLHyperlinks in REAL LIFE!!!!!!!!!! I have expirience with TestPartner, with Selenium, with Watin, with QTP and this <A>  is always HTMLHyperLink, not a custom HTML tag!!!!!!!!!!!!!!!!!!!!!!!! Also i had been automating the same site with TestPartner and all <A> ( and this also) was determining as HTMLHyperLink(not a custom object).

    <Atitle="cancel"href="************"> <SPANclass="button-left">&nbsp;</SPAN> <SPANclass="button-body">cancel</SPAN> <SPANclass="button-right">&nbsp;</SPAN></A>
    This is quite ridiculous! How to deal with this?today its HTMLCustom, tomorrow its HTMLHyperLink, on 3rd day its HTMLCustom once again.
    Also i have another question!!!! What does this mean HTMLCustom??????????? Browser can process only  certain tags! HTMLCode cant contains unknown or custom tags!!!!! all tags that should IE/browser support are described in HTML specifications!!!!!!!!! there shouldnot be any CUSTOM HTML tag. its really funny to see it. it can be generic web control ( that is not supported by CodedUI - flash, silv or unknown HTML tag) BUT NOT <A> tag!!!!!!!It should be alway HTMLhyperlink.
    i am upset. anybody help me with this and how to deal with this? raise an issue? sell this MVS?
    i am using licensed Premium MVS with Feature Pack2!!!





    • Edited by Prem user Monday, August 15, 2011 1:04 PM added
    • Edited by Tony xiaoModerator Friday, February 24, 2012 10:01 AM Personal project information
    Monday, August 15, 2011 12:58 PM

All replies

  • Hi,

    Please share the steps that you are tryinig to perform in your CodedUITest. Are you trying to click an image hyperlink or if there is some text that appears as a hyperlink that you need to click. Share some information about the steps and controls.

    Regards,

    Pankaj

    Monday, August 15, 2011 2:57 PM
  • i just want to click on this control  that i described above. all properties you can find in screenshot.

     

    this is HTML model of this hyperlink:
    <A title="add security code" onclick="addInstrumentType();"><SPAN class="button-left">&nbsp;</SPAN><SPAN class="button-body">add</SPAN><SPAN class="button-right">&nbsp;</SPAN></A>
    so i dont want to change conrol type tomorrow if someone from Dev will add "href" property instead of JavaScript. ( in this case CodedUI will change it from Custom Control to HTMLHyperlink control).
    or vice versa (someoone will remove href property and will add onlick JS    HTMLHyperlink - > HTMLCustom).


    Monday, August 15, 2011 3:09 PM
  • This code is working:

     

    HtmlCustom but = new HtmlCustom(this.ieObject);
                #region properties
                but.SearchProperties.Add(HtmlCustom.PropertyNames.Title, "add security code");
                but.SearchProperties.Add(HtmlCustom.PropertyNames.InnerText, "add",PropertyExpressionOperator.Contains);
                but.SearchProperties.Add(HtmlCustom.PropertyNames.TagName, "A");
                #endregion
                Playback.PlaybackSettings.SearchTimeout = 30000;
                Utils.LogWithBlankStatus("Clicking on Add security code button");
                Mouse.Click(but);

     

    and this - not:

     

    HTMLHyperLink but = new HTMLHyperLink (this.ieObject);
                #region properties
                but.SearchProperties.Add(HTMLHyperLink .PropertyNames.Title, "add security code");
                but.SearchProperties.Add(HTMLHyperLink .PropertyNames.InnerText, "add",PropertyExpressionOperator.Contains);
                but.SearchProperties.Add(HTMLHyperLink .PropertyNames.TagName, "A");
                #endregion
                Playback.PlaybackSettings.SearchTimeout = 30000;
                Utils.LogWithBlankStatus("Clicking on Add security code button");
                Mouse.Click(but);

     

    <A> tag should always be HTMLHyperLink, not HTMLCustom. Really don't understand this small-minded CodedUI.

    Monday, August 15, 2011 3:13 PM
  • just ensure it's HtmlHyperlink and not HTMLHyperlink. 

    What is the error?

    Monday, August 15, 2011 3:31 PM
  • this code will not compile in case HTMLHyperlink - its obviuos. the issue is that CodedUI test editor determine this object as HtmlCustom instead of HtmlHyperlink.

     

    error - control cannot be found.

    Monday, August 15, 2011 3:37 PM
  • I am not much into HTML/ASP/.NET but as far as my knowledge goes we can write our custom controls in ASP/.NET that may behave as the default available control set.

    In your case also, it seems to be a custom control wherein no href is defined and the onclick="addInstrumentType() handles the behaviour of the control once it is clicked. The <a> tag seems to be used to pick the style from the classes defined in the stylesheets.

    I am not an expert in this field and am just guessing from what I could understand.

    Regards,

    Pankaj

    Monday, August 15, 2011 3:57 PM
  • We are also facing similar issue. Did you find what is causing this behavior?
    Monday, December 10, 2012 3:10 PM