Topic: capybara-SELENIUM , how can I click a link active by hover a div

Hi everyone !
i HAVE A PROBLEM when follow "link" after hover div
@javascript
  Scenario:....
.....
   When I hover div_name
   Then I should see "link_follow"
   When I follow "link_follow"   (# when click link it run javascript to show a form hidden it view)  <===   error in this step

   Then I fill in "id_field" with "some_text"
   When I press "Submit"
....

In my step define :
When /^I hover div_name$/
   page.execute_script("$('.class_div').mouseover();")
end

IT RUN TO Then I should see "link_follow" AND IT WAITING (BUT in webdriver it SHOWED follow "link_follow" and run javascript ok)
THEN THROW ERROR :
Timeout::Error (Timeout::Error)
      /home/wf04/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:140:in `rescue in rbuf_fill'
      /home/wf04/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:134:in `rbuf_fill'
      /home/wf04/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:116:in `readuntil'
      /home/wf04/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:126:in `readline'
      /home/wf04/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:2219:in `read_status_line'
      /home/wf04/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:2208:in `read_new'
      /home/wf04/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:1191:in `transport_request'
      /home/wf04/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:1177:in `request'
      /home/wf04/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:627:in `start'
      (eval):2:in `click_link'
.........


NEED YOUR HELP! big_smile big_smile big_smile
THANK YOU TOO MUCH

Last edited by nobita175 (2012-02-01 04:38:05)

Re: capybara-SELENIUM , how can I click a link active by hover a div

I think this code may help:

<table>
   <tr>
      <td>
         <div style="border: 1px solid blue; background-color: #99CCFF; padding: 5px;">
            <a id="myHeader1" href="javascript:showonlyone('newboxes1');"  rel="nofollow">show this one only</a>
         </div>
         <div name="newboxes" id="newboxes1" style="border: 1px solid black; background-color: #CCCCCC; display: none;padding: 5px;">Div #1</div>
      </td>
      <td>
         <div style="border: 1px solid blue; background-color: #99CCFF; padding: 5px;">
            <a id="myHeader2" href="javascript:showonlyone('newboxes2');"  rel="nofollow">show this one only</a>
         </div>
         <div name="newboxes" id="newboxes2" style="border: 1px solid black; background-color: #CCCCCC; display: none;padding: 5px;">Div #2</div>
      </td>
      <td>
         <div style="border: 1px solid blue; background-color: #99CCFF; padding: 5px;">
            <a id="myHeader3" href="javascript:showonlyone('newboxes3');"  rel="nofollow">show this one only</a>
         </div>
         <div name="newboxes" id="newboxes3" style="border: 1px solid black; background-color: #CCCCCC; display: none;padding: 5px;">Div #3</div>
      </td>
   </tr>
</table>

I got success with this code in my MA moving website.

Last edited by karophi1 (2012-06-09 14:35:19)