SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 10 of 10
  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Reading Text Between <Span>

    Hi,
    I am developing a framework in RFT using java and I am using dynamic find method to recognize the objects in the webpage. I would like to capture the Error messages thrown by the AUT and store those errors in the result report.

    ErrorTexts are coded in the following way:
    &lt;SPAN class="errorText" jQuery1267699061340="40" htmlFor="email" generated="true"&gt;Please enter a valid email address&lt;/SPAN&gt;

    When i try searching for propname=class and propvalue=errorText, my program returns me an error that object not exists.

    Is there a way to read the text between span tag?

    Code snippet for finding existence of object:

    public boolean getElementByName_Exists(String propertyName, String propertyValue)
    {
    try
    {
    to = root.find(atDescendant(propertyName,propertyValue) );
    System.out.println(to.length);
    for(int i=0;i&lt;to.length;i++)
    {
    Object=(GuiTestObject) to[i];
    }
    if(to.length&gt;0)
    finder_flag=true;
    else
    finder_flag=false;
    unregisterAll();
    }
    catch(Exception e)
    {
    System.out.println("getElementByName_Exists: "+e.getMessage());
    }
    return finder_flag;

    }

    Thanks,
    Mehala

  2. #2
    Member
    Join Date
    Jul 2009
    Location
    Hyderabad,INDIA
    Posts
    382
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Reading Text Between <Span>

    Hi Sudharshan,

    Have you checked the properties of that span with Object Inspector? If not check the properties of that span object with the Object inspector.To start the object inspector from tool bar go to Run --&gt; Object Inspector.

    After selecting the option an object inspector window is opened.Hover your mouse to the object you will see the object properties in the Object inspector,press shift to freeze the properties in the object inspector.
    Thanks and Regards,
    Sathish

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Reading Text Between <Span>

    Hi Satish, When i hover over the particular object, the obj spy window is displaying all the labels in the particular frame.



    Is that possible?

  4. #4
    Member
    Join Date
    Jan 2009
    Posts
    62
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Reading Text Between <Span>

    hi there,

    how is the error displayed, embedded in the HTML page or as a popup message box ? if it's like a popup message box then probably is displayed using windows native boxes thus cannot be captured, however you will be able to use IWindow + keys close it.
    Tiberiu Hajas
    Software engineer
    http://www.000webhost.com/266351.html

  5. #5
    Junior Member
    Join Date
    Jan 2010
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Reading Text Between <Span>

    Hi Satish,
    My prev post was incomplete [img]/images/graemlins/frown.gif[/img] Somehow i couldnt able to attach the file...

    Here is what i wanted to convey:
    The below shown is how the obj spy is displaying the error texts:

    .classIndex: 0
    .id: loginForm
    .text: Existing online customer. Please enter a valid email address. Click here to SignIn

    In the .text property, the value of all the labels are displayed. i wanted to extract only the error text from the .text property ("Please enter a valid email id").

    Is there a way to do it?

    Thanks,
    Mehala <font color="red"> </font> <font color="green"> </font>

  6. #6
    Member
    Join Date
    Jul 2009
    Location
    Hyderabad,INDIA
    Posts
    382
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Reading Text Between <Span>

    In that spy window you have different views to view the object properties.Select the different view to view only hovered object properties.
    Attached Images Attached Images
    Thanks and Regards,
    Sathish

  7. #7
    Junior Member
    Join Date
    Jan 2010
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Reading Text Between <Span>

    I tried with different selections. but in vain. I am seeing the error text along with other labels as mentioned earlier. If i look at all the properties of the hovered object, the following properties are displayed:

    .class: Html.FORM
    .text: All labels in the particular form.

    Thanks,
    Mehala

  8. #8
    Member
    Join Date
    Jul 2009
    Location
    Hyderabad,INDIA
    Posts
    382
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Reading Text Between <Span>

    Try to identify the HtmlSpan object and then print all its properties as mentioned below.

    <font class="small">Code:</font><hr /><pre>

    System.out.printn(spanObject.getProperties().toStr ing());

    </pre><hr />

    Above code prints the span objects properties ,find the property which is printing the error message.
    Thanks and Regards,
    Sathish

  9. #9
    Junior Member
    Join Date
    Jan 2010
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Reading Text Between <Span>

    Hello Tiberiu,
    The error text is embedded in the HTML page.

    Thanks,
    Mehala

  10. #10
    Senior Member
    Join Date
    Sep 2000
    Location
    Twin Cities, MN, USA
    Posts
    653
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Reading Text Between <Span>

    Spans aren't mappable. You need to specify false for the mappable parameter in your find method:

    <font class="small">Code:</font><hr /><pre>
    TestObject[] atoSpan = document_htmlDocument().find(atDescendant(".class" , "Html.SPAN", ".className", "errorText"), false);
    System.out.println(atoSpan[0].getProperties().toString());
    </pre><hr />

 

 

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 9.68%
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 11:20 AM.

Copyright BetaSoft Inc.