Forum Discussion

Raj_Qa's avatar
Raj_Qa
Contributor
14 years ago

Access Web page elements using multiple Id`s

Hi,

I am trying to access certain web page elements, these elements are part of  a container and there are three such containers on the same page, which leads to three elements which are similar and have the same object Id. However each of these containers have a different Id, I want to access the elements from each container at a time referencing to the Id of the container, How can I ask Testcomplete to look for an object Id specific to one container (related to that object Id)



I am using Testcomplete 8.6, firefox version6.



Thanks

6 Replies

  • Mike,



    Could not get much help from those links, I need to know if I can look for an object (based on any property like class, href, id, name...) and reference it with another object`s property (class, href, id, name ....) sort of chaining it ....

    I hope there is a way to do this !!
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Very easy, actually.  Let's say I have a web component that displays an ID for something.  I can then grab that ID and use it to search for another component based upon the same ID.



    Something like:



    var NewID = Aliases.MyPage.MyObject.text;

    var NewComponent = Aliases.MyPage.FindChild("ID", NewID, 100);
  • Do you mind putting it in VBScript ? Appreciate your help

    Thanks
  • Hi Raj,



    Well, in VBScript, Robert's example looks very similar:

    Dim NewID, NewComponent

    NewID = Aliases.MyPage.MyObject.text

    Set NewComponent = Aliases.MyPage.FindChild("ID", NewID, 100)