Forum Discussion

ashok_natar's avatar
ashok_natar
Occasional Contributor
12 years ago

How to click an Object, which does not have any stable Properties

Hi, 



I have an Object, which does not have any Properties? 



I have a link which does not have any Properties, expect lable...so tried to reach that object by using ["QuerySelector"]("a:contains('Logout'), but its throwing an Object null error!! 



Please advise me on the same...

3 Replies

  • Hi Ashok,



    Unfortunately as far as I know :contains CSS selector is not supported by TestComplete currently.

    If you have stable html text but no stable attributes, you can use either:

    1) var link = NativeWebObject.FindChild('innerHtml', 'Log Out', 1000)

    You'll have to map some object that will be a parent for 'Log Out' link in object browser.

    or

    2) var link = page.FindChildByXPath("//a[text()='Log Out']);

    You have to declare what is page before you use 2.

    for example:

    var page = Sys.Browser("*").Page("*");



    Hope it helps.
  • ashok_natar's avatar
    ashok_natar
    Occasional Contributor
    Really appreciated for your reply!!! 



    I have already gone through that thread and that thread did not helped me as i dont have an attribute