Unable to Click and gettext for a nobr tag inside td . This table pops up when a input field is clicked. Help me.

345 views
Skip to first unread message

Nidhish Narayana

unread,
Dec 18, 2012, 4:01:50 AM12/18/12
to webd...@googlegroups.com

  I am using FF10 and Selenium 2.25.  In my application i have a input box which when clicked opens a list of items like drop down. And its a table inside a DIV tag.Even though i ma bale to loop through the TD , i am not able to click or gettext the data.. it displays null when i tried gettext(). and when used click nothting happens.. 
here is the html code.. here there is a input field when click displays two values as drop down male and female.. Can anyone help..that wud be of great help! Thanks in advance

<div id="ctl189:556c538c-6bf5-4559-8bef-793de2267080:_popup" class="emptyBG" style="display: block; position: absolute; top: 388px; left: 1116px; z-index: 5001; width: 334px;" ispopup="true">
<div id="dynamicFrame" class="boxInner">
<div id="grid_generictablename_6" class="grid gridDefault" drop_types="X" drop_type="XXX" ondragleave="OutDrag(event)" ondragenter="InDrag(event)" ondragover="InDrag(event)" ondrop="FinishDrag('_dd_ctl63', event)" detach="1" name="grid_generictablename_6">
<div style="vertical-align:top;width:;height:300px;overflow-x:hidden;overflow-y:auto;" resize="v" table="_dd_ctl63" body="" grid3_id="_dd_ctl63_scroll_v">
<table id="_dd_ctl63" class=" " cellspacing="0" cellpadding="1" pagesize="2" footersize="0" filteredrows="0" copieditemsid="cpy_grid_generictablename_6" drag_action="Move" remote="1" allow_entity_context_menu="1" pagerstyle="Dropdown" deselecteditemsid="des_grid_generictablename_6" ondragstart="StartDrag(event)" selecteditems="" pagenumber="1" drag_type="XXX" pagebuttoncount="5" headersize="0" hastotals="0" pagingdisabled="true" pagersize="0" style="width: 100%;">
<tbody>
<tr drop_info="Female" selectable="true" drag_info="F" class="" style="cursor: auto;">
<td style="width:100%;">
<nobr>Female</nobr>
</td>
</tr>
<tr class="multiRowSelect" drop_info="Male" selectable="true" drag_info="M" e="" style="cursor: pointer;">
<td style="width:100%;">
<nobr>Male</nobr>
</td>
</tr>
</tbody>
</table>
<span style="display:none;"></span>
</div>
Reply

darrell

unread,
Dec 18, 2012, 9:39:53 AM12/18/12
to webd...@googlegroups.com
It looks like your web page is heavy in javascript. You need to figure out what is REALLY happening from a DOM perspective. For example, I have an editor which has a drop down. When a user clicks the drop down the DOM actually makes an Ajax call to the server, gets a list of items, populates an unorder list in an iframe which then appears as if it is part of the drop down but is REALLY a separate frame.

In this case the WebDriver code needs to find the iframe, select an LI from the unordered list and the javascript takes care of moving it to look like I selected it in the drop down.

I would scan the DOM before I select anything then scan it again after I select something. If possible, watch the DOM as I select something. From this manual exploration I can usually figure out what is going on and what I need to code in WebDriver.

You'll have to do the same thing. Trying to explain how to do this in an email would be VERY difficult. The concept is easy but each actual implementation is hard. So this is probably the best I can help you with.

Darrell

Nidhish Narayana

unread,
Dec 18, 2012, 10:57:34 AM12/18/12
to webd...@googlegroups.com
Thanks Darrell, 
 Will try based on your inputs! 

-Nidhish

Bill Ross

unread,
Dec 19, 2012, 12:03:42 PM12/19/12
to webd...@googlegroups.com
If WebElement.getText() doesn't work, WebElement.getAttribute("text")
might (just did for me on a list of Select options).

Bill
> --
> You received this message because you are subscribed to the Google Groups "webdriver" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/OUtsMuxEvqMJ.
> To post to this group, send email to webd...@googlegroups.com.
> To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.
>
Reply all
Reply to author
Forward
0 new messages