SeleniumLibrary icon indicating copy to clipboard operation
SeleniumLibrary copied to clipboard

1. "Maximise browser Window" keyword not working in IE,FF and chrome.I am using selenium2Library.Could you please help me in resolving the issue.

Open PriyaAn opened this issue 14 years ago • 13 comments

PriyaAn avatar Sep 28 '12 04:09 PriyaAn

See #83 for possible fix for this issue.

emanlove avatar Oct 01 '12 13:10 emanlove

I too was getting the same issue with "Maximise browser window" keyword when i used Selenium2library in ROBOT framework.

The "Maximise browser window" keyword is not maximizing the Firefox browser window.

Thanks emanlove. Now it is working very fine. The Fix u suggested is working fine for me.

The "Maximise browser window" keyword is now properly maximizing the Firefox browser window.

just to help others i am mentioning the Steps I followed to fix the issue.

step1: when selenium2library is installed in robot frame work , the selenium2library will create the python files (these python files contains the python code for selenium keywords) in the path "C:\Python27\Lib\site-packages\Selenium2Library\keywords"

step2: Among these python files the code for keyword "Maximise browser window" is present in the python file with name "_browsermanagement.py"

step3: We can find the below code(method) for the keyword "Maximise browser window" in "_browsermanagement.py" file. this code is not working. This code is not actually maximizing the firefox browser window. def maximize_browser_window(self): """Maximizes current browser window.""" self._current_browser().execute_script( "if (window.screen) { window.moveTo(0, 0); window.resizeTo(window.screen.availWidth, window.screen.availHeight); }")

step4: copy the above file and save it with another name for backup sake. This will help us if we need to revert back quickly incase of any issues.

step5: Now replace the above mentioned code in the "_browsermanagement.py" file with the following code. def maximize_browser_window(self): """Maximizes current browser window.""" self._current_browser().maximize_window()

step5: Save the file "_browsermanagement.py" after editing. Note: make sure u r saving the file in proper encoding technique. I used only "notepad" which comes as deafult with windows to edit and save the file, as i got encoding problem when i edit and saved the file with notepad++. so please double check once before editing and saving. if u face any issues. get back the same file from the back up file we saved.

step6: Now u can perform the same operation what ur doing using the keyword "Maximise browser window". This works fine now.

srib4ufrnd avatar Oct 04 '12 09:10 srib4ufrnd

Thanks " srib4ufrnd" for taking out your valuable time and explaining it so well...It solved my problem.

PriyaAn avatar Oct 08 '12 10:10 PriyaAn

Fixed under Selenium2Library Version 1.1

emanlove avatar Dec 11 '12 15:12 emanlove

I am on selenium2library 1.8.0. I am still facing issue with maximize window on chrome / firefox on mac. Do we have to change the "browsermanagement.py" or is there any other work around to fix this?

mithunsureshqa avatar Apr 17 '18 14:04 mithunsureshqa

When you are reporting an error, it would be a good idea to also tell what error you get. Also, Selenium2Library is not going to be developed further. If the problem still occurs with the latest SeleniumLibrary, you can open a new issue.

pekkaklarck avatar Apr 17 '18 14:04 pekkaklarck

Sorry @pekkaklarck, i am new to this. Since my problem was basic thread subject ""Maximise browser Window" keyword not working in chrome.I am using selenium2Library.Could you please help me in resolving the issue." , i thought i can just add a comment. I am on python 2.7 --> selenium2library ==3.0.0. Using "Maximize Browser Window" command for chrome. The chrome browser does resize, but is not fullscreen. Since the browser does not maximize, i see a tablet view of site instead of desktop view. Let me know if i have to add any additional detail.

mithunsureshqa avatar Apr 17 '18 18:04 mithunsureshqa

Please also make sure that you are running latest version of Selenium and ChromeDriver in your Mac.

aaltat avatar Apr 17 '18 19:04 aaltat

@aaltat i have selenium2library ==3.0.0 [which i hope is the latest, i upgraded today using pip] & chrome driver = 2.37. https://sites.google.com/a/chromium.org/chromedriver/downloads --> is the latest. i am still facing issues.

mithunsureshqa avatar Apr 17 '18 19:04 mithunsureshqa

Selenium and SeleniumLibrary are two different packages. If you give command pip freeze you should see the Selenium version and latest should be 3.11.0. But I think easiest way to find where the problem is to you to run the following script:

import time

from selenium import webdriver


driver = webdriver.Chrome()
driver.get('https://github.com/robotframework/SeleniumLibrary')
driver.maximize_window()
time.sleep(5)
driver.quit()

Save the script in a foobar.py and run it from command line. When running, if you result are the same as with SeleniumLibrary, then the problem is in with Selenium and not with SeleniumLibrary. In this case please raise an issue to the Selenium issue tracker: https://github.com/SeleniumHQ/selenium/issues

aaltat avatar Apr 17 '18 20:04 aaltat

Thank you @aaltat. I verified the selenium. i have selenium==3.11.0. I see same issue with on running the test as mentioned above. I will create an issue in the selenium tracker. Thanks for the help.

mithunsureshqa avatar Apr 17 '18 21:04 mithunsureshqa

I was just using Maximize Browser Window today on SeleniumLibrary (not 2) and it was working fine.

On Tue, Apr 17, 2018 at 9:20 AM, Pekka Klärck [email protected] wrote:

When you are reporting an error, it would be a good idea to also tell what error you get. Also, Selenium2Library is not going to be developed further. If the problem still occurs with the latest SeleniumLibrary, you can open a new issue.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/robotframework/SeleniumLibrary/issues/123#issuecomment-382010066, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAoXc7HNBydaxBf24Zh1bgY-OdRcRsQks5tpfongaJpZM4ALM4o .

-- Ruby: http://blog.rubygeek.com - http://www.twitter.com/rubygeek http://www.linkedin.com/in/nolastowe - my linkedin profile http://github.com/rubygeek - my code

rubygeek avatar Apr 18 '18 01:04 rubygeek

I also observed "Maximize Browser Window" keyword doesn't work issue on my mac machine. According to my investigation keyword works fine on windows machine but fails on mac machine.

And It seems issue is on selenium side since with above python script also we could observe the same behaviour.

gvasanka avatar Sep 26 '18 06:09 gvasanka