Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

window.maximize doesn't wait for window to be actually maximized #7405

Closed
lukeis opened this issue Mar 4, 2016 · 5 comments
Closed

window.maximize doesn't wait for window to be actually maximized #7405

lukeis opened this issue Mar 4, 2016 · 5 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 4, 2016

Originally reported on Google Code with ID 7405

Selenium Webdriver - 2.42.0
Firefox - 29.0
Ubuntu 14.04

The following scenario fails intermittently. I think it's because "maximize" doesn't
wait for window to be maximized. I would expect "driver.manage.window.maximize" to
wait for window to be maximized.






require "selenium-webdriver"

driver = Selenium::WebDriver.for :firefox
screen_size = driver.execute_script("return [window.screen.availWidth, window.screen.availHeight];")
original_handle = driver.window_handle
begin
  (1..20).each do |i|
    driver.execute_script('window.open();')
    driver.switch_to.window(driver.window_handles[1])
    driver.manage.window.maximize
    sleep 0.03 # if you aren't able to reproduce, remove sleep; if it's reprodicible
at step 1, increase it
    actual_size = driver.execute_script("return [window.outerWidth, window.outerHeight];")
    raise "error at iteration #{i}" if screen_size != actual_size
    driver.close
    driver.switch_to.window(original_handle)
  end
ensure
  driver.quit
end

Reported by botalov.andrey on 2014-05-28 21:40:32

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Yes, it does not, by design.

Reported by barancev on 2014-06-02 15:13:43

  • Status changed: WorkingAsIntended
  • Labels removed: Status-Untriaged

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I think it should be reopened. From https://github.com/SeleniumHQ/irc-logs/blob/master/2014/06/02.txt:

abotalov: Some days ago I asked here a question about switchToWindow not waiting for
window to be switched. But I was wrong and in reality it waits. However, later on I
found that maximizeWindow also doesn't wait - https://code.google.com/p/selenium/issues/detail?id=7405.
But it was declined. Why?

lukeis: abotalov: i'm not 100% certain why, but that sounds more like a bug for the
spec (if it doesn't clearly state that the response should happen only after the new
size has been established)

abotalov: IMHO the spec is quiet clear here - "After maximizeWindow, the browser window
currently in focus must be left as if the maximise button had been pressed"

abotalov: Or do you think it should be improved?

ato: abotalov: I think #7405 is still an issue, because WD is, by default, meant to
be blocking.

abotalov: ato: so can it be reopened?

ato: So when you call driver.get, you expect the API call to not return before it's
actually done getting the page.

ato: I think the same logic applies to maximizing the window.

ato: barancev: ↑

Reported by botalov.andrey on 2014-06-09 09:01:15

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

OK, reopening.

Reported by barancev on 2014-06-09 20:01:13

  • Status changed: New

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

We discussed this issue again recently, and agreed that windows size manipulation operations
are asynchronous by nature, because we can't control window rendering effects added
by a window manager, and browsers don't provide a callback that would allow to detect
the end of windows size changing process.

Reported by barancev on 2015-04-05 15:40:08

  • Status changed: NotFeasible

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by luke.semerau on 2015-09-17 18:22:29

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 4, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant