Forum Discussion

ThomasCasserly's avatar
ThomasCasserly
Frequent Contributor
4 years ago

Custom ID not being displayed by object spy when using Firefox

Hi all , 

 

I have an issue when mapping object where the object spy is not showing me a custom id in the object properties, when using Firefox, but does show it when using Chrome.

 

The custom id is definitely generated for the control in both Firefox and Chrome, as I can see it if I inspect the object using the build in Inspectors in both browsers.

 

An example:

I have a icon that can be clicked on. to view the custom id, I spy the object, choose the "parentElement" property and then the "attributes" and I can see my custom id value on Chrome, exact same path on Firefox does not show me the custom id. Screenshots are added to illustrate this. 

 

Any ideas why the custom id is not being presented in the object properties when spying objects on Firefox?

  • Actually found this from a previous community post, but appreciate the responses.

     

    SmartBear Community response:
    Hi,

    If I got it right, you are trying to inspect custom attributes of some SPAN element accessed via parentElement property of its child.

    The reason you can't see those attributes is that the property returns a native browser object instead of TestComplete extended object. Native browser objects return "raw" attributes and dataset collections, those collections do not list attribute names as properties (see NamedNodeMap and DOMStringMap). For that purpose you need to use TestComplete-specific Parent property instead of the native parentElement (the reason you can successfully use parentElement in Google Chrome is, in fact, an undocumented trait of TestComplete implementation of Chrome support).

    Another important thing is that, most likely, you are using parentElement instead of Parent because your SPAN element is not included in TestComplete object tree and, thus, not accessible via Parent. If so, you can either try not to use the SPAN in your tests/NameMapping at all, or, make this SPAN appear in the object tree by adding text content or role attribute to the SPAN (see Web Elements Included in and Excluded From the Tree Model).

    • ThomasCasserly's avatar
      ThomasCasserly
      Frequent Contributor

      Thanks for the suggestion vinniew  but having installed the patch the issue is still occurring. Custom Object ID is still not displaying on the object properties.

      Going to double check the browser configuration for Firefox in case something there isn't as required by TestComplete

    • ThomasCasserly's avatar
      ThomasCasserly
      Frequent Contributor

      I have checked all Firefox requirements and everything is set as expected. 

       

      Testcomplete is still not displaying the custom ID under the attributes node of the object property for Firefox, while it is still being displayed for the same node on Chrome.

  • ThomasCasserly's avatar
    ThomasCasserly
    Frequent Contributor

    Actually found this from a previous community post, but appreciate the responses.

     

    SmartBear Community response:
    Hi,

    If I got it right, you are trying to inspect custom attributes of some SPAN element accessed via parentElement property of its child.

    The reason you can't see those attributes is that the property returns a native browser object instead of TestComplete extended object. Native browser objects return "raw" attributes and dataset collections, those collections do not list attribute names as properties (see NamedNodeMap and DOMStringMap). For that purpose you need to use TestComplete-specific Parent property instead of the native parentElement (the reason you can successfully use parentElement in Google Chrome is, in fact, an undocumented trait of TestComplete implementation of Chrome support).

    Another important thing is that, most likely, you are using parentElement instead of Parent because your SPAN element is not included in TestComplete object tree and, thus, not accessible via Parent. If so, you can either try not to use the SPAN in your tests/NameMapping at all, or, make this SPAN appear in the object tree by adding text content or role attribute to the SPAN (see Web Elements Included in and Excluded From the Tree Model).