Results 1 to 6 of 6

Thread: Using DataTables for DP

  1. #1
    Junior Member
    Join Date
    Feb 2008
    Answers
    3

    Using DataTables for DP

    I'm trying to do something, I thought, was simple.

    I'm grabbing some link titles from the DataTable and I'm trying to use it as a Link().Click

    So I navigate all the static pages

    Browser("micClass:=Browser").Page("micClass:=Page").Link("micClass:=Level1").Click
    Browser("micClass:=Browser").Page("micClass:=Page").Link("micClass:=Level2").Click

    'Grab the next pages I want to iterate through
    lnk = (DataTable ("iterLink", dtGlobalSheet))


    Browser("micClass:=Browser").Page("micClass:=Page").Link(lnk).Click 'should be Link("name:=[lnk]").Click Or something like that
    Browser("micClass:=Browser").Page("micClass:=Page").Sync

    'Do some reusable actions that test the page
    'Finish and go to the next page to test


    ------
    I'm doing it this way because all of the tests are the same, but the page that is to be tested changes on a daily bases and someone else selects what gets tested.

    They don't use QTP and I figured a script that reads the Excel sheet would be easiest. So I want it to be as flexible as possible. I'm using the title of the pages because they are unique and I want to use the .Click to capture the active screen (the Navigate method doesn't do that for me) and the url (href) changes from time-to-time.

    I hope it makes sense what I'm doing. What do I need to do to make this work? Is there a better method?

    Thanks in advance for any help.

    PS: I did try to use Description.Create() but it doesn't work correctly. the result shows that it can identify it (put a square around the link), but it cannot use the object (click it).


  2. #2

    Thumbs down Re: Using DataTables for DP

    Try this:

    Dim strLink
    strLink = DataTable(“iterLink”, dtGlobalSheet)

    Browser(“micClass:=Browser”).Page(“micClass:=Page”).Link(“url:=”&strLink).Click
    Browser(“micClass:=Browser”).Page(“micClass:=Page”).Sync

    Last edited by Anshoo_Arora; 02-28-2008 at 08:30 PM.

  3. #3
    Junior Member
    Join Date
    Feb 2008
    Answers
    3

    Re: Using DataTables for DP

    Quote Originally Posted by Anshoo_Arora View Post
    Try this:

    Dim strLink
    strLink = DataTable(“iterLink”, dtGlobalSheet)

    Browser(“micClass:=Browser”).Page(“micClass:=Page”).Link(“url:=”&oLink).Click
    Browser(“micClass:=Browser”).Page(“micClass:=Page”).Sync
    Thanks for the prompt reply Anshoo.

    It still doesn't recognize the link name. I get a run error "cannot identify object..." and then it highlights the link.

    Dim strLink
    strLink = (DataTable(“iterLink”, dtGlobalSheet))

    Browser(“micClass:=Browser”).Page(“micClass:=Page”).Link(“name:=”&strLink).Click
    Browser(“micClass:=Browser”).Page(“micClass:=Page”).Sync

    Was what I tried.

    I changed the .Link(“name:=”&strLink).Click because I this is what you meant. Is &o something special? it gets highlighted as if it's in quotes. I changed it to &o as well but that didn't do anything.

    Any other suggestions?


  4. #4

    Re: Using DataTables for DP

    Your concept is correct. I think that you have multiple links on the same page with the same name. Try using the index property.

    Like this:

    Dim strLink
    strLink = DataTable(“iterLink”, dtGlobalSheet)

    Browser(“micClass:=Browser”).Page(“micClass:=Page”).Link(“name:=”&strLink, "index:=0").Click
    Browser(“micClass:=Browser”).Page(“micClass:=Page”).Sync


    Wait.. the above code might not work. Looking at the error message, I think you are not able to uniquely identify the link object. I would suggest you to use "url", but I am not sure how objects are defined in your application. If you could message me the object properties of one of your links, we might be able to work out a solution.

    Last edited by Anshoo_Arora; 02-28-2008 at 08:39 PM.

  5. #5
    Junior Member
    Join Date
    Feb 2008
    Answers
    3

    Re: Using DataTables for DP

    Quote Originally Posted by Anshoo_Arora View Post
    Your concept is correct. I think that you have multiple links on the same page with the same name. Try using the index property.

    Like this:

    Dim strLink
    strLink = DataTable(“iterLink”, dtGlobalSheet)

    Browser(“micClass:=Browser”).Page(“micClass:=Page”).Link(“name:=”&strLink, "index:=0").Click
    Browser(“micClass:=Browser”).Page(“micClass:=Page”).Sync

    Wait.. the above code might not work. Looking at the error message, I think you are not able to uniquely identify the link object. I would suggest you to use "url", but I am not sure how objects are defined in your application. If you could message me the object properties of one of your links, we might be able to work out a solution.
    Your right, the first two links are too similar that it won't uniquely identify it. No other link has the problem

    The links look like:

    Demo - Link 1
    Demo - HotLink 2
    Fire 3
    Dog 4
    Rabbit 5

    Something to that extent.

    I was about to send you my Object Spy file for a couple of links when I decide to take a step back and directly test the value. Now that I realize the problem I need to change my method. There's nothing else that is unique enough to use the method I want. I need to figure something else out.

    Thank you so much.


  6. #6

    Re: Using DataTables for DP

    Why don't you use their "url" property instead of name? You can simply copy their urls and replace them with the names you have entered in the DataTable.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact