Merge pull request #192 from seleniumbase/chrome-window-sizing
Set Chrome window default sizing
This commit is contained in:
commit
f21be3a709
|
@ -1,8 +1,8 @@
|
|||
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/SB_Logo3g4.png" title="SeleniumBase" height="45">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
|
||||
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/SB_Logo16.png" title="SeleniumBase" height="48">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
|
||||
|
||||
[<img src="https://img.shields.io/pypi/v/seleniumbase.svg" alt="Version" />](https://pypi.python.org/pypi/seleniumbase) [<img src="https://img.shields.io/github/stars/seleniumbase/seleniumbase.svg" alt="GitHub Stars" />](https://github.com/seleniumbase/SeleniumBase/stargazers) [<img src="https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master" alt="Build Status" />](https://travis-ci.org/seleniumbase/SeleniumBase) [<img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt="Join the Gitter Chat" />](https://gitter.im/seleniumbase/SeleniumBase)<br />
|
||||
[<img src="https://img.shields.io/pypi/v/seleniumbase.svg" alt="Version" />](https://pypi.python.org/pypi/seleniumbase) [<img src="https://img.shields.io/badge/python-2.7,_3.*-22AADD.svg" alt="Python versions" />](https://pypi.python.org/pypi/seleniumbase) [<img src="https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master" alt="Build Status" />](https://travis-ci.org/seleniumbase/SeleniumBase) [<img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt="Join the Gitter Chat" />](https://gitter.im/seleniumbase/SeleniumBase) [<img src="http://img.shields.io/badge/license-MIT-22BBCC.svg" alt="MIT License" />](https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE) [<img src="https://img.shields.io/github/stars/seleniumbase/seleniumbase.svg" alt="GitHub Stars" />](https://github.com/seleniumbase/SeleniumBase/stargazers)<br />
|
||||
|
||||
SeleniumBase extends [WebDriver](https://docs.microsoft.com/en-us/microsoft-edge/webdriver) into a complete framework for end-to-end testing with [Pytest](https://github.com/pytest-dev/pytest).
|
||||
SeleniumBase transforms [WebDriver](https://www.seleniumhq.org/) into a complete test framework that runs with [Pytest](https://github.com/pytest-dev/pytest).
|
||||
|
||||
## ![http://seleniumbase.com](https://cdn2.hubspot.net/hubfs/100006/images/super_logo_tiny.png "SeleniumBase") Quick Start
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import warnings
|
|||
from selenium import webdriver
|
||||
from selenium.common.exceptions import WebDriverException
|
||||
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
||||
from seleniumbase.config import settings
|
||||
from seleniumbase.config import proxy_list
|
||||
from seleniumbase.core import download_helper
|
||||
from seleniumbase.fixtures import constants
|
||||
|
@ -73,11 +72,6 @@ def _set_chrome_options(downloads_path, proxy_string):
|
|||
chrome_options.add_argument("--disable-web-security")
|
||||
if proxy_string:
|
||||
chrome_options.add_argument('--proxy-server=%s' % proxy_string)
|
||||
if settings.START_CHROME_IN_FULL_SCREEN_MODE:
|
||||
# Run Chrome in full screen mode on WINDOWS
|
||||
chrome_options.add_argument("--start-maximized")
|
||||
# Run Chrome in full screen mode on MAC/Linux
|
||||
chrome_options.add_argument("--kiosk")
|
||||
if "win32" in sys.platform or "win64" in sys.platform:
|
||||
chrome_options.add_argument("--log-level=3")
|
||||
return chrome_options
|
||||
|
|
|
@ -2252,11 +2252,22 @@ class BaseCase(unittest.TestCase):
|
|||
# Make sure the invisible browser window is big enough
|
||||
try:
|
||||
self.set_window_size(1920, 1200)
|
||||
self.wait_for_ready_state_complete()
|
||||
except Exception:
|
||||
# This shouldn't fail, but in case it does,
|
||||
# get safely through setUp() so that
|
||||
# WebDrivers can get closed during tearDown().
|
||||
pass
|
||||
else:
|
||||
if self.browser == 'chrome':
|
||||
try:
|
||||
if settings.START_CHROME_IN_FULL_SCREEN_MODE:
|
||||
self.driver.maximize_window()
|
||||
else:
|
||||
self.driver.set_window_size(1250, 800)
|
||||
self.wait_for_ready_state_complete()
|
||||
except Exception:
|
||||
pass # Keep existing browser resolution
|
||||
return new_driver
|
||||
|
||||
def switch_to_driver(self, driver):
|
||||
|
|
2
setup.py
2
setup.py
|
@ -7,7 +7,7 @@ from setuptools import setup, find_packages # noqa
|
|||
|
||||
setup(
|
||||
name='seleniumbase',
|
||||
version='1.14.3',
|
||||
version='1.14.4',
|
||||
description='Web Automation & Testing Framework - http://seleniumbase.com',
|
||||
long_description='Web Automation and Testing Framework - seleniumbase.com',
|
||||
platforms='Mac * Windows * Linux * Docker',
|
||||
|
|
Loading…
Reference in New Issue