I'm trying to click on an element (link) in a drop down which only appears when hovering over an element. Unfortunately I cannot provide a link to the site where issue is occurring, as functionality is not available on our Live site yet. See below for the HTML code for which this issue concerns:
<li class="sub-menu">
<span class="label">Signed in as</span>
<span class="val">Xkeek Javed Wezacur</span>
<a href="#user-actions">Menu</a>
<ul id="user-actions">
<li>
<li>
<li>
<a href="/sign_out">Sign out</a>
</li>
</ul>
</li>
Now I am trying to access and click code:
<a>href="/sign_out">Sign out</a>
I have tried various solutions, but get errors everytime. See below for what I have tried and the errors I have received:
@browser.li(:class, 'sub-menu').ul(:id, 'user-actions').link(:text, 'Sign out').click
Element cannot be scrolled into view:https://xxxuat.com/sign_out (Selenium::WebDriver::Error::MoveTargetOutOfBoundsError)
@browser.ul(:id, 'user-actions').link(:text, 'Sign out').click
Element cannot be scrolled into view:https://xxxuat.com/sign_out (Selenium::WebDriver::Error::MoveTargetOutOfBoundsError)
@browser.link(:text, 'Menu').link(:text, 'Sign out').click
unable to locate element, using {:text=>"Sign out", :tag_name=>"a"} (Watir::Exception::UnknownObjectException)
@browser.link(:text, 'Sign out').click
Element cannot be scrolled into view:https://xxxuat.com/sign_out (Selenium::WebDriver::Error::MoveTargetOutOfBoundsError)
I have tried to find some answers using stackoverflow and Google groups, if I can be pointed in the right direction I would be very grateful. Thank you guys.
Environment: Mac OSX 10.7.5, Firefox 19.0.2, Ruby 1.9.3p194, watir-webdriver 0.6.2
I just tried:
@browser.link(:text, 'Menu').fire_event('onmouseover'),
@browser.li(:class, 'sub-menu', :text, 'Sign out').link.click
The error I got was:
expected Hash or (:how, 'what'), got [:class, "sub-menu", :text, "Sign out"] (ArgumentError).
Now I am confused