Forum Discussion

grant_volker_2's avatar
grant_volker_2
Contributor
12 years ago

Good practice to use NativeWebObject with browsers other than Internet Explorer?

Hi,



I am running the following code on various browsers (IE7, IE8, FF and Chrome), with success it seems:




arrProperty(0) = "tagName"


arrValue(0) = "SPAN"


arrProperty(1) = "contentText"


arrValue(1) = arrDataFromDataDriver(0)


 

Set objLink = objPage.NativeWebObject.Find(arrProperty(1), arrValue(1), arrValue(0))



I have used the ObjectSpy on a TextNode and Panel for a particular object and in the properties I see NativeWebObject in IE7, NativeFirefoxObject in Firefox,  and NativeChromeObject in Chrome.



Although the NativeWebObject property is not available in Chrome and Firefox for this object, it seems to return the object I am searching for.



Is there anything I should be aware of or cautions with using NativeWebObject for testing in Chrome and Firefox browsers please?



Thank you,

Grant
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Grant,


     


    Let me quote the reply you got from the TestComplete Support:


    The NativeWebObject.Find method should be available in any browser's Page object, and it should work with all of them. This is a 'global' method which isn't browser-dependent, and it is safe to use it. However, I wouldn't recommend using the NativeWebObject namespace (except for NativeWebObject.Find) with browsers other than IE. This namespace was originally added to resolve conflicts between IE's properties and methods (such as name or id), and this can make your tests IE-dependent. Since properties and methods added to this namespace do not depend on TC, but are taken from the browser, there's no guarantee that they will be there in all cases.