8

I am working with Selenium 2.0 and as far I thought, Selenium doesn't really care about the size of your browser. But when I click a dropdown menu, it can't seem to find all the elements not in the view of the browser whereas when its maxed out it can.

I personally thought it crawls through the web script but my observations prove me wrong.

Comments?

Indigo
  • 777
  • 2
  • 13
  • 25

1 Answers1

8

Your assumptions about the inner workings of Selenium may have been correct for Selenium RC, which was a JavaScript-based technology used in Selenium 1.0. Being entirely JavaScript-based, however, meant that it was limited to the browser's JavaScript sandbox, which precluded some actions in the browser.

Selenium 2.0 introduced Selenium WebDriver, which is a different paradigm of web automation. WebDriver attempts to model the user experience and actions as closely as possible. Since modeling the user experience dictates certain design and technology choices for interacting with elements, it likely won't work if the browser is minimized, since a user cannot interact with the page while the browser window is minimized.

Incidentally, I'd be surprised if finding the elements was the issue with executing WebDriver code. Interacting with the elements found, like attempting to click on them or send keystrokes to them, I would completely expect that to fail.

JimEvans
  • 27,201
  • 7
  • 83
  • 108
  • It was working till my co-worker updated the webpage. I used to minimize the window and it used to send keystrokes. – Indigo Sep 22 '14 at 18:05
  • That statement is a little too broad. I guarantee that it wouldn't work in IE if you minimized the window. Basically running minimized has never been supported in WebDriver; you were getting lucky that it ever did. – JimEvans Sep 23 '14 at 02:14
  • Doe usingFirefox driver make it different? I got no idea how i got lucky cause I was doing that for a month and suddenly it stopped doing that. Its so strange for me. I used to let my code run while I change my code – Indigo Sep 23 '14 at 02:19
  • The Firefox driver, if memory serves, recently added more stringent checks for whether or not an element could be interacted with. These checks would include whether the element was scrolled into the viewport of the browser. If the browser is minimized, what's the size of the viewport? If your answer to that question is, "very small," or, "I don't know," then there's a pretty good bet that you _had_ just been getting lucky for the last month. – JimEvans Sep 23 '14 at 02:28
  • You are currently bit above my understanding. Please bring it to a lower level. I won't answer I dont know cause I want to know and I am trying to find out. I did stuff like clicking buttons and going through all the pages and printing all contents alongwith verifying the details with the database – Indigo Sep 23 '14 at 02:36