Forum Discussion

tmahender12's avatar
tmahender12
Frequent Contributor
8 years ago

Finding a content in form of key and value from a webpage

I have a requirement where i need to get the account no and value present in the panels of webpage, the structure of the panel is attached,i need to find ex:1-1000 has 1600 as amount

the string(account code) we are searching can be in any of the "sub panels/sub sub panels((highlighted panels)" under above. after matching the text i need to get respective amount which is present in  some other panel

 

account code: Sys.Browser("iexplore").Page("***").Panel("outer_wrapper").Panel("wrapper").Panel("pageContents").Panel("reporting_report").Panel(2).Panel(0).Panel(1).Panel(0).Panel(1).Panel(0).Panel(0).Panel(1).Panel(1).Panel(0).Panel(0).Panel(0) 

 

amount:

Sys.Browser("iexplore").Page("***").Panel("outer_wrapper").Panel("wrapper").Panel("pageContents").Panel("reporting_report").Panel(2).Panel(0).Panel(1).Panel(0).Panel(1).Panel(0).Panel(0).Panel(1).Panel(1).Link(0)

 

please let me know if we have solution for this, attached screen shot

  • AlexKaras's avatar
    AlexKaras
    Icon for Champion Level 3 rankChampion Level 3

    Hi,

     

    Your best bet would be to talk to developers and ask them to provide unique and meaningful identifiers for both key and value panels (e.g. 'key_1_1000' for the key and 'val_1_1000' for the value) so you can quickly and reliably locate them.

    If this is not an option, than I am afraid that the only option for you is to look for the key panel by its content text (exact match) and then implement some logic to find matching value panel (e.g. "for the found key panel, navigate two levels up, then look for the child panel with the next index and look there for the panel with the same index that the found key panel has").

    Obviously, the latter approach requires more time for the implementation and is less reliable and this may be a good argument in your talk to developers and management when they ask you why development should spend their efforts on this.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Have you looked at using contentText, innerText, etc., for getting the contents of the panel?  I mean, if you've identified the panel, you're 90% of the way there.  The other 10% is choosing which property contains the value you're looking for.

     

    That said... are panels the only components you have here?  Are there tables, textboxes, etc? It's not clear from your screenshot what the panels are and what the link is.  A screenshot of the objects in your object browser will probably help further to give you a viable solution.

    • tmahender12's avatar
      tmahender12
      Frequent Contributor

      Hi,

       

      thanks for your reply

      the Content-text contains lot of data, we need just account code from that(ex: 1-1400), how to get only required data?

       

      attached screenshot