SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Dec 2002
    Location
    Colorado
    Posts
    61
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Java Dropdown Menu Not Recording By Name

    I have a dropdown menu in a java app which I need to choose from based on the name (because I need to make this data driven), instead QTP records this by index.

    Under Tools, Options, Java, the Record items mode is set to "By name".

    The line of code is:

    JavaWindow("TCAdvisor II - Accounts").JavaDialog("TCAdvisor II - Manage").JavaList("Model:").Select "#37"

    But I need for it to search for a choice in the dropdown by the value/text "46 - B". I can spy and don't see anything that will help to identify by a name.

    What I might be able to do is call a java method to get the name value I'm looking for. The developer gave me the code to get the text. I'm stumbling trying to get QTP to correctly use it. I'm trying to follow Problem ID: 22794 on Mercury’s knowledge base, but still need assistance.

    The java developer stated:

    This call would return the TEXT in the Model Combo Box.

    ((TcListItem)getAvailableModelComboBox().getSelect edItem()).getText()

    One example would return “DOMESTIC INCOME INVESTMENTS STRATEGY”

    So far I tried variations of this, but QTP doesn't like the code:

    ' Create object.
    Set ListObj = JavaWindow("TCAdvisor II - Accounts").JavaDialog("TCAdvisor II - Manage").JavaList("Model:").Object

    ' Call method
    Set Rect = ListObj.((TcListItem)getAvailableModelComboBox().g etSelectedItem()).getText()

    ' Call the toString method of the returned Rect object.
    MsgBox Rect.toString()

    Please help! I have hundreds of dropdowns and hundreds of choices depending on the dropdown. Nightmare! Or help me brainstorm another way around this.

  2. #2
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: Java Dropdown Menu Not Recording By Name

    You cant just copy paste a java code in VBScript and assume that it will work

    use
    Set Rect = ListObj.getAvailableModelComboBox().getSelectedIte m().getText()

  3. #3
    Member
    Join Date
    Dec 2002
    Location
    Colorado
    Posts
    61
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Java Dropdown Menu Not Recording By Name

    Thanks for your response, Tarun.

    QTP is choking on:
    Set ListObj = JavaWindow("TCAdvisor II - Accounts").JavaDialog("TCAdvisor II - Manage").JavaList("Model:").Object

    Any helpful hints for me about this?

    Thank you!
    Daphne

 

 

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 12.50%
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:28 AM.

Copyright BetaSoft Inc.