Yeah, that's annoying. Think I filed a Webdriver bug a one point (I wasn't the 
only one) but not sure if they ever did anything with it. 

If you don't have to use Chrome, It might be worth trying Firefox. Driver 
install is not required for that and it's a little less fussy, although think I 
saw a similar scrolling problem with a recent version. 
You could also try send_keys to get the browser to scroll up or down 
conditionally, as needed (you may have to set the focus on a non-editable 
element before doing the send_keys so that they don't go to some element 
instead of the browser.) 
b.send_keys :space          # Down one frame.
b.send_keys :shift, :space # Up one frame.       From: Awesome Possum 
<[email protected]>
 To: Watir General <[email protected]> 
 Sent: Monday, April 18, 2016 7:16 PM
 Subject: [wtr-general] Watir-webdriver throws 'not clickable' error even when 
element is visible, present 
   
I am trying to automate tests in Ruby using the latest Watir-Webdriver 0.9.1, 
Selenium-Webdriver 2.53.0 and Chrome extension 2.21. However the website that I 
am testing has static headers at the top or sometimes static footers at the 
bottom. Hence since Watir auto-scrolls an element into view before clicking, 
the elements get hidden under the static header or the static footer. I do not 
want to set desired_capabitlites (ElementScrollBehavior) to 1 or 0 as the 
websites I am testing can have both - static header or static footer or 
both.Hence the question are 1) Why does Watir throw an exception 'Element not 
clickable' even when the element is visible and present? See ruby code ( I have 
picked a random company website for an example) and the results below.2) How 
can I resolve this without resorting to ElementScrollBehaviour?
Ruby code:
require 'watir-webdriver'

browser = Watir::Browser.new :chrome

begin
  # Step 1
  browser.goto "shop.coles.com.au/online/mobile/national"

  # Step 2 - click on 'Full Website' link at the bottom
  link = browser.link(text: "Full website")

  #check if link exists, present and visible?
  puts link.exists?
  puts link.present?
  puts link.visible?

  #click on link
  link.click

rescue => e
  puts e.inspect
ensure
  sleep 5
end

puts browser.url
browser.close
Result:
$ ruby link_not_clickable.rbtrue true 
trueSelenium::WebDriver::Error::UnknownError: unknown error: Element is not 
clickable at point (460, 1295). Other element would receive the click: div 
class="shoppingFooter"...div(Session info: chrome=50.0.2661.75) (Driver info: 
chromedriver=2.21.371459 
(36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Mac OS X 10.10.5 
x86_64)>http://shop.coles.com.au/online/mobile/nationalthanks!
-- 
-- 
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]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.


  

-- 
-- 
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]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to