mozilla / geckodriver

WebDriver for Firefox
https://firefox-source-docs.mozilla.org/testing/geckodriver/
Mozilla Public License 2.0
7.11k stars 1.52k forks source link

set_window_size does not work properly #56

Closed drobota closed 8 years ago

drobota commented 8 years ago

1) It fails with Connection reset by peer

----> 1 ff.set_window_size(1000, 1000)

/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.pyc in set_window_size(self, width, height, windowHandle)
    834             command = Command.W3C_SET_WINDOW_SIZE
    835         self.execute(command, {'width': int(width), 'height': int(height),
--> 836           'windowHandle': windowHandle})
    837 
    838     def get_window_size(self, windowHandle='current'):

/usr/local/lib/python2.7/site-packages/Selenium2Library/webdrivermonkeypatches.pyc in execute(self, driver_command, params)
      9 
     10     def execute(self, driver_command, params=None):
---> 11         result = self._base_execute(driver_command, params)
     12         speed = self._get_speed()
     13         if speed > 0:

/Users/dm08/projects/zeus/aphrodite/src/AphroditeLibrary/webdrivermonkeypatches.pyc in execute(self, driver_command, params)
     22                 time.sleep(1)
     23 
---> 24         return self._base_execute2(driver_command, params)
     25 
     26     def is_page_loading(self):

/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.pyc in execute(self, driver_command, params)
    229 
    230         params = self._wrap_value(params)
--> 231         response = self.command_executor.execute(driver_command, params)
    232         if response:
    233             self.error_handler.check_response(response)

/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.pyc in execute(self, command, params)
    393         path = string.Template(command_info[1]).substitute(params)
    394         url = '%s%s' % (self._url, path)
--> 395         return self._request(command_info[0], url, body=data)
    396 
    397     def _request(self, method, url, body=None):

/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.pyc in _request(self, method, url, body)
    424             try:
    425                 self._conn.request(method, parsed_url.path, body, headers)
--> 426                 resp = self._conn.getresponse()
    427             except (httplib.HTTPException, socket.error):
    428                 self._conn.close()

/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.pyc in getresponse(self, buffering)
   1130 
   1131         try:
-> 1132             response.begin()
   1133             assert response.will_close != _UNKNOWN
   1134             self.__state = _CS_IDLE

/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.pyc in begin(self)
    451         # read until we get a non-100 response
    452         while True:
--> 453             version, status, reason = self._read_status()
    454             if status != CONTINUE:
    455                 break

/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.pyc in _read_status(self)
    407     def _read_status(self):
    408         # Initialize with Simple-Response defaults
--> 409         line = self.fp.readline(_MAXLINE + 1)
    410         if len(line) > _MAXLINE:
    411             raise LineTooLong("header line")

/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.pyc in readline(self, size)
    478             while True:
    479                 try:
--> 480                     data = self._sock.recv(self._rbufsize)
    481                 except error, e:
    482                     if e.args[0] == EINTR:

error: [Errno 54] Connection reset by peer

In [18]: ff.set_window_size(1000, 1000)

In [19]: ff.set_window_size(1000, 1000)
---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
<ipython-input-19-c6fe6880f545> in <module>()
----> 1 ff.set_window_size(1000, 1000)

/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.pyc in set_window_size(self, width, height, windowHandle)
    834             command = Command.W3C_SET_WINDOW_SIZE
    835         self.execute(command, {'width': int(width), 'height': int(height),
--> 836           'windowHandle': windowHandle})
    837 
    838     def get_window_size(self, windowHandle='current'):

/usr/local/lib/python2.7/site-packages/Selenium2Library/webdrivermonkeypatches.pyc in execute(self, driver_command, params)
      9 
     10     def execute(self, driver_command, params=None):
---> 11         result = self._base_execute(driver_command, params)
     12         speed = self._get_speed()
     13         if speed > 0:

/Users/dm08/projects/zeus/aphrodite/src/AphroditeLibrary/webdrivermonkeypatches.pyc in execute(self, driver_command, params)
     22                 time.sleep(1)
     23 
---> 24         return self._base_execute2(driver_command, params)
     25 
     26     def is_page_loading(self):

/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.pyc in execute(self, driver_command, params)
    229 
    230         params = self._wrap_value(params)
--> 231         response = self.command_executor.execute(driver_command, params)
    232         if response:
    233             self.error_handler.check_response(response)

/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.pyc in execute(self, command, params)
    393         path = string.Template(command_info[1]).substitute(params)
    394         url = '%s%s' % (self._url, path)
--> 395         return self._request(command_info[0], url, body=data)
    396 
    397     def _request(self, method, url, body=None):

/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.pyc in _request(self, method, url, body)
    424             try:
    425                 self._conn.request(method, parsed_url.path, body, headers)
--> 426                 resp = self._conn.getresponse()
    427             except (httplib.HTTPException, socket.error):
    428                 self._conn.close()

/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.pyc in getresponse(self, buffering)
   1130 
   1131         try:
-> 1132             response.begin()
   1133             assert response.will_close != _UNKNOWN
   1134             self.__state = _CS_IDLE

/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.pyc in begin(self)
    451         # read until we get a non-100 response
    452         while True:
--> 453             version, status, reason = self._read_status()
    454             if status != CONTINUE:
    455                 break

/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.pyc in _read_status(self)
    407     def _read_status(self):
    408         # Initialize with Simple-Response defaults
--> 409         line = self.fp.readline(_MAXLINE + 1)
    410         if len(line) > _MAXLINE:
    411             raise LineTooLong("header line")

/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.pyc in readline(self, size)
    478             while True:
    479                 try:
--> 480                     data = self._sock.recv(self._rbufsize)
    481                 except error, e:
    482                     if e.args[0] == EINTR:

error: [Errno 54] Connection reset by peer

2) It raises WebDriverException: Message: Invalid requested size, cannot maximize randomly
it does not matter if screen size is smaller, bigger or the same as screen resolution

Tested on Os:

Browser:

Selenium: 2.53.1 - python

Wires

jgraham commented 8 years ago

Can you try this again with the latest release? I think it may have been an unrelated issue where we tried to reuse a http connection even if the client dropped it.

andreastt commented 8 years ago

@drobota Please also test this against Firefox Nightly if you can.

drobota commented 8 years ago

@andreastt I tested it against the latest firefox 50.0a1 I can say that I don't get any connection reset by peer errors what is good however In case I use window size which is bigger that my screen size I get WebDriverException: Message: Requested size exceeds screen size that is a drastic change in behaviour because in current implementation my window would be set to the maximum possible size.

Tested on: Lang: python 2.7 Selenium: 2.53.5 Firefox: 50.0a1(2016-06-13) Os: mac os x 10.11 Driver: geckodriver 0.8

andreastt commented 8 years ago

@drobota You’re right, and according to the specification, Marionette is wrong here. I’ve filed bug 1280101 to address this.

Also thanks for your feedback, this is very useful to us moving our WebDriver implementation forward! :+1:

I’m going to close this issue because it is specifically about an HTTP connection issue, and that appears to have been solved.

hjwp commented 8 years ago

+1 -- am not quite clear, is the fix for this "upgrade to firefox nightly?"

andreastt commented 8 years ago

@hjwp Bug 1280101 that fixes the “requested size exceeds window size” error has landed on mozilla-inbound, which is our staging tree, but has not yet made it to mozilla-central of which Nightly is built. But it should be available in a Nightly build very soon.

jgraham commented 8 years ago

Fixed in nightly.

andreastt commented 8 years ago

This has now been uplifted to Beta and Aurora as well.

ghost commented 7 years ago

Can you please confirm whether the fix for the window size error is done or rolled back. I am currently using FF 48+ and Selenium(2.53.1, 3.0.0-beta(123)) all give me the same exception unless i set the window size to 1024X768. This is breaking my tests because the elements are out of the window scope.

ghost commented 7 years ago

According to this bug 1280101 they rolled back the changes? Anyone else seeing this problem?

andreastt commented 7 years ago

@soumyamulu It was backed out of Firefox 48, but is available in 49.

lock[bot] commented 5 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have run into an issue you think is related, please open a new issue.