0

I am working on automating my app using Watir Webdriver.My app contains a big table with 3-4 pages of data.I have been using xpaths to identify the elements.

I have to identify certain headers in the table.All of them may not be in the same page, i will have to scroll down to see. How can i check if the header is visible on the screen? Is "visible?" reliable?

Thanks

user2993178
  • 97
  • 1
  • 12

1 Answers1

0

In most cases you want to use #present? instead of #visible (they return the same result, but have different error handling).

These methods rather accurately inform you whether an element that is in the DOM will be rendered on the screen, not whether or not that element is in the viewport. (your use of the word 'pages' indicates that this distinction might be important).

titusfortner
  • 4,099
  • 2
  • 15
  • 29
  • Thanks for that. Is there anyway to check if an element is in the viewport ? – user2993178 Mar 08 '16 at 10:13
  • You might be able to use something like [Sikuli|http://www.sikuli.org/] to tell if it is visable. you'd have to run your watir code on Jruby to be able to mix in Sikuli stuff since it is java based. – Chuck van der Linden Mar 08 '16 at 16:52
  • You can use this javascript - http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport. – titusfortner Mar 08 '16 at 17:20