0

For our web application I wrote one selenium script, which is working very fine in my office workstation (which has big screen).

When I execute the same script for the same application in my laptop(which has small screen) it is not able to find the element.

Actually when I open the application in my laptop some elements are visible only when I scroll down the page but those element are visible in big screen without scrolling. Application view is automatically adjust as per the screen.

So, for these application how I can write the selenium script so that it will work any kind of screen ?

joy87
  • 25
  • 4
  • try to scroll down in the selenium test. see [here](http://stackoverflow.com/questions/12293158/page-scroll-up-or-down-in-selenium-webdriver-selenium-2-using-java) – metar Dec 14 '16 at 11:03
  • But scrolling is not require for all screen. As I said when I navigate application in my office workstation scrolling is not required. – joy87 Dec 14 '16 at 11:09
  • but it looks like its required for your small screen. So even if you scroll on your big screen nothing will probably happen.. so it wont affect your test at all. Or check if the particular element your looking for is already visible, if not scroll down.. else do nothing. can you provide source of the website? – metar Dec 14 '16 at 11:10
  • During my testing I have to navigate many pages and frame. So as per your suggestion whenever I navigate any page or frame I have to add the code for scrolling. – joy87 Dec 14 '16 at 11:16
  • well, since I don't see any source of the website its hard to help. You need to trigger the part which loads the remaining content you want to read.. – metar Dec 14 '16 at 11:18
  • Our web application is not accessible from public network. It is hosted on private server. – joy87 Dec 14 '16 at 11:52

2 Answers2

0

What do you mean by "it is not able to find the element"? Which error did it show?

In my own experience with automation, in some specific scenarios, the behavior of the app change when the scrollbar appears (for example, when I try to click on an element, it scrolls down to that element, but "jumps up" to the element above it - this I can reproduce manually.)

Some test scenarios are quite sensitive with scrollbar, for example drag&drop.

You should analyse each failed test separately and find a solution for each case.

Linh Nguyen
  • 1,120
  • 7
  • 13
0

Selenium cannot find element that is not visible, you must always check if element is visible and if not scroll to this element.

see this question Scroll Element into View with Selenium

Community
  • 1
  • 1
mackowski
  • 366
  • 5
  • 15