Forum Discussion

seafalcon's avatar
seafalcon
Contributor
16 years ago

findId() is for web application?

According to the manual:



Description


Each object has its unique ID. To get a child object of the current one by the ID of this child object, use the FindID method.


Declaration



TestObj.FindId(IdRefresh)




























   TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section

 
Id [in] Required Integer
Refresh [in] Optional Boolean Default value: True
Result Object  


Applies To



All processes, windows, controls and onscreen objects.



Parameters


The method has the following parameters:




Id



Specifies the object ID. The method returns the object that has the same ID.







for win form application, each object doesnt require a specific ID... So this findId trick may not work for winform application?





16 Replies

  • If you are certain you have the correct object (you've put a break point in there and checked EXACTLY what is stored as an object during the run I hope) then the problem is with the object, not the method of finding it.



    In other words - your problem is the object, not how you find it, and isn't really to do with this thread.



    I would suggest you start a separate thread with details of the object if you can't get any controls to work on it ...



    There's little point in me trying it as I won't be working with the same object as you.
  • Just out of curiosity, I did give this method a quick try. It's not one I use normally. And having tried it, I doubt I ever will!



    So ....



    I assigned a webpage to a variable - Set obj = sys("browser").page("blah")

    I then tried using the findId method on the stored page - Set findObj = obj.FindId(<id No.>)



    I tried searching for a couple of object further down the hierarchy on the page.



    I can't get it to work. At all.



    Using IE - it seems to return an object. But the object is empty. ID's do seem to be present and correct in IE.

    Using Chrome - Nothing. Which is not surprising as Chrome is showing "0" for the ID for all object on the page for me!



    (I used the object spy against the same page in both browsers to determine the ID's to search for)



    Conclusion - I have no idea whats going on with your object! (If it's even finding it - I would like you to confirm you have actually put in a break point and inspected the result of your search)
  • I'm using TC10.50, the FindID works for window application (not tested with web). And it only finds control with ID from testedObj's Child objects (search depth = 0).



    My guessing would also be finding a wrong object. What message do you get when calling vVerifybyID.Click?



    I would suggest you to output FullName of the object you find to make sure it is the one you need, then try a simple test to call Click (or ClickButton) directly from the FullName string you just get to see if the clicking works.



    -Ocean
  • Vallalarasu_P's avatar
    Vallalarasu_P
    Frequent Contributor
    Hi,



     I found that the return value from FINDID is a stub and not an object. So the output of FINDID can be used to check only the Existance. Nothing more.



    But the other find options are returning an Object.



    Suggesting SmartBear to make findid more similar to other find options. So it saves lot of time taken during execution.



    Correct me If I'm wrong
  • Calling FindID, if a control with the ID is found, return the found control, otherwise, it a control with the ID not found, then return a stub object.



    In your case, if it returns a stub object, it means no control with the ID is there.



    -Ocean
  • Vallalarasu_P's avatar
    Vallalarasu_P
    Frequent Contributor


    The issue is.. Even if the object exist, it returns only the value as a stub. I'm not able to perform any operation. 



     



    The checked the same object with FindID and FindAll, this makes the difference.





    Correct me If I'm wrong