I was able to open the Javascript widget by using a 'onmousedown' fire_event
and while I wasn't able to manipulate the tree I was able to set the value 
of the hidden object and submit the form that way to accomplish the same 
thing.



On Tuesday, August 28, 2012 12:42:50 PM UTC-5, Clayton Havens wrote:
>
> I am trying to convert old Selenium scripts and I've been able to do 
> everything else except for interacting with a Javascript Table our site 
> uses to select regions.   I've included a image and the HTML code from the 
> page.   Hopefully someone can find the flaw that I'm having trying 
> identifying the object and to open it.
>
> *Actions I'm trying to do in RSpec*
> it "Test to Try and change Region" do
>    @browser.div(:id, "regionTR").fire_event "onmouseover"
>    @browser.element_by_xpath("//div[@id='twtreeRegion4466']/div[2]").click
> end
>
> *Error received:*  unable to locate object
>
> *I have also tried *
> @browser.element_by_xpath(:xpath, ".//*[@id='a-reg']").click
> @browser.element_by_xpath(:xpath, ".//*[@id='a-reg']").fire_event 
> "onmouseover" 
> @browser.div(:id, "a-reg").click 
> @browser.div(:id, "a-reg").fire_event "onmouseover"  
>
> **Reference the selenium script that I'm trying convert uses the 
> following and is able interact with the objects*
> selenium.clickAt("a-reg", "");
> selenium.click("//div[@id='twtreeRegion4466']/div[2]");
>
> *HTML CODE SNIPPET*
> <tr>
> <td class="left">
> <td class="right">
> <table>
> <tbody>
> <tr>
> <td id="regionTR" align="left" title="Click to select the region" style="">
> <div id="btn-reg">
> <a style="display:block; width:300px; height:17px; text-decoration: none; 
> cursor:pointer;" onkeydown="javascript:regionMenuKeypress(event);" 
> href="javascript:void(0);">
> <table class="regionDropdown" cellspacing="0" cellpadding="0" 
> style="table-layout: fixed;">
> <tbody>
> <tr>
> <td class="leftfilter"></td>
> <td id="a-reg" class="middlefilter">Baden-Württemberg</td>
> <td class="rightfilter"></td>
> </tr>
> </tbody>
> </table>
> </a>
> </div>
> <div id="regionMenu" class="filterbox" align="left" style="display:none;">
> </td>
> </tr>
> </tbody>
> </table>
> </td>
> </tr>
> <tr>
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to