SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 8 of 8
  1. #1
    Junior Member
    Join Date
    Feb 2008
    Location
    Boston, MA
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Identify Form Names

    Hi All,

    I'm having issues with identifying forms in QTP, and need some help!

    I have 2 forms: <form name="form1"> and <form name=form2">, and both forms have the same contents. How do I distinguish between the two? I read that "id" would be better suited, but I do not have that option.

    Thanks all for your help!

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Location
    USA
    Posts
    776
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Identify Form Names

    Post Snippet of page source code here.
    Thanks,
    Prashant Patel

  3. #3
    Senior Member
    Join Date
    Oct 2005
    Location
    London, U.K
    Posts
    1,804
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Identify Form Names


    Simple answer - You can use an ordinal identifier for your objects.

  4. #4
    Junior Member
    Join Date
    Feb 2008
    Location
    Boston, MA
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Identify Form Names

    Form1 or Form2 might or might not be displayed, depending on a number of factors. The only thing I have that identifies each for is their name.

    <FORM ACTION="X" METHOD="GET" name="Form1">
    Contents
    </form>

    <FORM ACTION="Y" METHOD="GET" name="Form2">
    Contents
    </form>

    Any ideas?

  5. #5
    Senior Member
    Join Date
    Oct 2005
    Location
    London, U.K
    Posts
    1,804
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Identify Form Names

    Perhaps give us your actual test case. What are you trying to do?

  6. #6
    Junior Member
    Join Date
    Feb 2008
    Location
    Boston, MA
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Identify Form Names

    Both forms have dynamic content, but each form has at least a "submit" button. Let's say, I want to select item1 from the dropdown in form2. I want to be able to identify form2 so that I can manipulate and submit that particular form.

    Ideally, I would like to have something like:
    Browser("browser").Page("page").Frame("frame").Web Element("form2").WebList("weblist").Select "item1"

    but the form name isn't recognized by the object spy.

    Thanks again for your help.

  7. #7
    Junior Member
    Join Date
    Feb 2008
    Location
    Boston, MA
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Identify Form Names

    Anyone has any idea how to get a form to either been seen in object spy, or to just use it?

    Thanks!

  8. #8
    Member
    Join Date
    Aug 2007
    Location
    Colorado, USA
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Identify Form Names

    [ QUOTE ]

    Ideally, I would like to have something like:
    Browser("browser").Page("page").Frame("frame").Web Element("form2").WebList("weblist").Select "item1"


    [/ QUOTE ]
    As I believe Turbografx was suggesting try:
    'Form 1
    Browser("browser").Page("Page").Weblist("name:=Web listname", "index:=0").select "Item1" '

    'Form 2
    Browser("browser").Page("Page").Weblist("name:=Web listname", "index:=1").select "Item1"

    Name should be more stable than ID when dealing with a form. Name is a required attribute for form elements whereas ID is not.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:20 PM.

Copyright BetaSoft Inc.