Skip to content

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. #123

Closed

Description

@PriyaAn
No description provided.

Activity

  1. emanlove commented on Oct 1, 2012

    @emanlove
    Member

    See #83 for possible fix for this issue.

  2. srib4ufrnd commented on Oct 4, 2012

    @srib4ufrnd

    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.

  3. PriyaAn commented on Oct 8, 2012

    @PriyaAn
    Author

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

  4. emanlove commented on Dec 11, 2012

    @emanlove
    Member

    Fixed under Selenium2Library Version 1.1

  5. mithunsureshqa commented on Apr 17, 2018

    @mithunsureshqa

    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?

  6. pekkaklarck commented on Apr 17, 2018

    @pekkaklarck
    Member

    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.

  7. mithunsureshqa commented on Apr 17, 2018

    @mithunsureshqa

    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.

  8. aaltat commented on Apr 17, 2018

    @aaltat
    Contributor

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

  9. mithunsureshqa commented on Apr 17, 2018

    @mithunsureshqa

    @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.

  10. aaltat commented on Apr 17, 2018

    @aaltat
    Contributor

    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

  11. mithunsureshqa commented on Apr 17, 2018

    @mithunsureshqa

    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.

  12. rubygeek commented on Apr 18, 2018

    @rubygeek
    Contributor
  13. gvasanka commented on Sep 26, 2018

    @gvasanka

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions