SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Member
    Join Date
    Dec 2002
    Posts
    39
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Clicking on a dynamically generated object in RobotJ

    Hi,
    I have a Dhtml web application where a html Table is created dynamically at run time. The Table contains links which the user clicks to move to the next page. How can I detect the Table on play back?.

    When playing back my scripts RobotJ throws an exception "Object not found" with a messege "No plausible candidate was found". I tried to readd the object to the Test map. But it gave the same exception. I tried as described by Rational support website

    http://www-1.ibm.com/support/docview...id=swg21133292
    http://www-1.ibm.com/support/docview...id=swg21133327

    But still i couldn't detect the mouse click on the dynamic table.

    I would appreciate any kind of help or suggestions.

    Thanks in advance.

  2. #2
    Senior Member
    Join Date
    Mar 2003
    Location
    Austin, TX, USA
    Posts
    1,489
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Clicking on a dynamically generated object in RobotJ

    First, we need to know what testobect you're passing into the function in that first link. What confuses me is that you say you're getting an error that the object can't be found. What object can't be found? The parent you're passing into the function or the link you've found? Testobjects are arranged in a hierarchy structure. Getmappable children retrieves all immediate child objects. You may have to start with the Table's parent which may be another table (check the object map). Find the mappable children of this parent and identify the table. Pass the table in and get its children. See what shows up for the table's children (loop through the array[] of objects and output relevant properties), you'll either see the links or cells (I can't remember). If you see the cells, you'll have to get the mappable children and find the link in it. However, the easier method would be to pass in a parent object and recursively navigate down the tree of its children, 'grandchildren', etc. Put everything it finds of class link into a separate array and then search through those to find the one you need. Here's how:

    http://www.qaforums.com/cgi-bin/foru...=000096#000002

    Also try these:

    http://www.qaforums.com/cgi-bin/foru...=000177#000000
    http://www.qaforums.com/cgi-bin/foru...=000111#000000

    If you need more help, post your code and a complete description of your table's hierarchy structure (its parent and children as viewable in the object map).

    [ 12-10-2003, 07:22 AM: Message edited by: cyblue ]

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

    Re: Clicking on a dynamically generated object in RobotJ

    Hello Bryan,
    Could you please check the following file
    1071263312.txt

  4. #4
    Senior Member
    Join Date
    Mar 2003
    Location
    Austin, TX, USA
    Posts
    1,489
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Clicking on a dynamically generated object in RobotJ

    I would think you're getting some compile errors or either you've left something out. Add 'Vector ObjectList;' to your getTestObjects method. Maybe you have it listed as a global variable up top, but I wouldn't advise using that programming practice. Then modify testMain like this:

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Vector ObjectList = getTestObjects(Frame_messboard_frame());</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">and something about this line looks odd:

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">TestObject[] children = (TestObject[])ObjectList.toArray(new TestObject[0]);</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">delete that and change your clickTable function to accept a vector as input and pass ObjecList to it. Then poll through the vector using .elementAt(i) and casting into a TestObject. Try adding this line into the clickTable for loop:

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">System.out.println((String)object.getP roperty(&quot;.class&quot);</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">that should output a list of testObject classes to your XDE console. You should see some of class Html.A as well as all other objects. If you don't see anything, then you know somehow you're not getting the objects into the Vector. Use the same method elsewhere to see what's happening. I think you can even System.out.println(&lt;Vectorname&gt

    [ 12-15-2003, 07:40 AM: Message edited by: cyblue ]

  5. #5
    Senior Member
    Join Date
    Mar 2003
    Location
    Austin, TX, USA
    Posts
    1,489
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Clicking on a dynamically generated object in RobotJ

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">tO = (TestObject)v.elementAt(i);
    if ((String)tO.getProperty(&quot;.class&quot).trim().equalsIgnoreCase(&quot;Html.A&quot
    {
    link = (GuiTestObject)tO;
    link.click();
    }</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Does that look about like what you have now? (of course you'll have to declare tO and link appropriately.

    [ 12-15-2003, 02:30 PM: Message edited by: cyblue ]

  6. #6
    Member
    Join Date
    Dec 2002
    Posts
    39
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Clicking on a dynamically generated object in RobotJ

    Hi Bryan,

    Thanks for the response and suggestions. I modified my code based on your suggestions. Now I'm able to find the Object, but I'm not able to programatically click on the Object.

    The Object is a link of class Html.A and Class type is GuiTestObject. Currently i'm trying to click by calling GuiTestObject.click() method. But it doesn't work. I don't have the URL (as suggested in another thread in this forum) as the URL itself is dynamic (generated using JavaScript on the HTML page).

    Is there any other way to programatically perform a mouse click? I wanted to mention that I am using RobotJ version 2002.05.

    Thank you very much.

  7. #7
    Member
    Join Date
    Dec 2002
    Posts
    39
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Clicking on a dynamically generated object in RobotJ

    Hello Bryan,

    I tried typecasting as you suggested. Also tried creating a new GuiTestObject. But still it doesn't work. My code looks like this.


    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;"> private void clickTable(Vector testObjects) {
    String className = null;
    for (int i = 0; i &lt; testObjects.size(); i++) {
    TestObject object = (TestObject)testObjects.get(i);

    className = (String) object.getProperty(&quot;.class&quot;
    System.out.print(&quot; class: &quot; + className); //to verify it is a link.
    System.out.print(&quot; index: &quot; + object.getProperty(&quot;.classIndex&quot);
    System.out.println(&quot; value: &quot; + object.toString());

    if ((((String)object.getProperty(&quot;.class&quot).trim().equalsIgnoreCase(&quot;Html.A&quot)
    &amp;&amp; (((String)object.getProperty(&quot;.text&quot).trim().equalsIgnoreCase(&quot;Alert1&quot)) {
    //
    System.out.println(&quot;----------- Found the object - Alert1 ---------------------------------&quot;

    try {

    ((GuiTestObject)object).click();

    //GuiTestObject newObj = new GuiTestObject(object);
    //newObj.click();



    }
    catch (Exception e) {}
    }
    }</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Once again thanks for your time.

  8. #8
    Senior Member
    Join Date
    Mar 2003
    Location
    Austin, TX, USA
    Posts
    1,489
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Clicking on a dynamically generated object in RobotJ

    The commented line looks about like what I've always used. In the past I've had problems when trying to do it all in one line like in your code. However, you have an extra set of parenthesis that might make that work that I never tried.

    GuiTestObject gto;
    gto = (GuiTestObject) object;
    gto.click();

    I'm not sure of the differences in Vector.get() and Vector.elementAt(). I've always used the elementAt(), so give that a try as well. Is your "found the object" message printing out? What kind of error are you getting at this point?

    [ 12-16-2003, 01:28 PM: Message edited by: cyblue ]

  9. #9
    Member
    Join Date
    Dec 2002
    Posts
    39
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Clicking on a dynamically generated object in RobotJ

    Hello Bryan,

    I tried with Vector.elementAt() and also the given code. Still it doesn't work. But I'm getting the "Found the object - Alert1 ".

    Also I could find the object using "Browse object Hierarchy to Select" button on the "Insert a GUI Object into the object Map" dialog box. The object is Link_Alert1. And I added that object into the current script. Still it doesn't work.
    I created another simple scipt using this object
    Script looks like this.

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">public void testMain (Object[] args)
    {
    startApp(&quot;url&quot;

    Text_UserName().click(atPoint(9,8));
    Browser_htmlBrowser(Document_AdexaeGPS(),DEFAULT). inputKeys(
    &quot;admin{TAB}admin&quot;
    Button_Loginsubmit().click();

    sleep(4.0);

    //The commented code is the actual code I get when recording.
    //Table_HtmlTable_2().click(atCell(atRow(atIndex(0)) , atColumn(atIndex(0))));


    //I added the following code after I found out the correct Object
    Link_Alert1().click();

    }</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">When I tried like this I got error like this.
    Exception Context:cick() called on GuiTestObject(Map:Alert1)
    Exception Name:com.rational.test.ft.UnsupportedActionExcepti on
    Exception Messege:No screen point found for object
    Exception Stack: at com.rational.test.ft.domain.html.HtmlGuiProxy.noSc reenPointFoundForAction(Unknown source)
    at
    Sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e method)

    Do you have any idea why this Exception is coming?
    I have added this object to the TestMap as well as to my Script.

    I would appreciate any kind of help or suggestions.

  10. #10
    Senior Member
    Join Date
    Mar 2003
    Location
    Austin, TX, USA
    Posts
    1,489
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Clicking on a dynamically generated object in RobotJ

    hmmmmm, sorry. I guess I'm out of ideas. If the link is visible on the screen, then I'm not sure why it can't click on it.

 

 
Page 1 of 2 12 LastLast

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 11.54%
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:43 AM.

Copyright BetaSoft Inc.