From 061275c2b7dbe5c1943fedc678d739d68eed18db Mon Sep 17 00:00:00 2001 From: nlaurance Date: Sat, 16 Jul 2016 20:03:24 +0100 Subject: [PATCH 1/2] allow to pass an chrome Options instance to Browser --- docs/drivers/chrome.rst | 23 +++++++++++++++++++++++ splinter/driver/webdriver/chrome.py | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/docs/drivers/chrome.rst b/docs/drivers/chrome.rst index 0917e1325..3c5bd4635 100644 --- a/docs/drivers/chrome.rst +++ b/docs/drivers/chrome.rst @@ -115,6 +115,29 @@ the ``Browser`` instance: **Note:** if you have trouble with ``$HOME/.bash_profile``, you can try ``$HOME/.bashrc``. +Using emulation mode in Chrome +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Chrome options can be passed to customize Chrome's behaviour; it is then possible to leverage the +experimental emulation mode. + +.. highlight:: python + +:: + + from selenium import webdriver + from splinter import Browser + + mobile_emulation = {"deviceName": "Google Nexus 5"} + chrome_options = webdriver.ChromeOptions() + chrome_options.add_experimental_option("mobileEmulation", + mobile_emulation) + browser = Browser('chrome', options=chrome_options) + + +refer to `chrome driver documentation `_ + + API docs -------- diff --git a/splinter/driver/webdriver/chrome.py b/splinter/driver/webdriver/chrome.py index f3c6304bb..ad5a882be 100644 --- a/splinter/driver/webdriver/chrome.py +++ b/splinter/driver/webdriver/chrome.py @@ -14,8 +14,8 @@ class WebDriver(BaseWebDriver): driver_name = "Chrome" - def __init__(self, user_agent=None, wait_time=2, **kwargs): - options = Options() + def __init__(self, options=None, user_agent=None, wait_time=2, **kwargs): + options = Options() if options is None else options if user_agent is not None: options.add_argument("--user-agent=" + user_agent) From bf58254f4c9ed01343fd82ce5c21dabf15bd5c4b Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Tue, 14 Feb 2017 11:11:29 +0200 Subject: [PATCH 2/2] Bump to Edraak's version --- VERSION | 2 +- docs/conf.py | 4 ++-- setup.py | 2 +- splinter/__init__.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 7d8568351..01b7df36e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.4 +0.5.4.1 diff --git a/docs/conf.py b/docs/conf.py index 74847d6a0..78e199a0d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -50,9 +50,9 @@ # built documents. # # The short X.Y version. -version = '0.5.4' +version = '0.5.4.1' # The full version, including alpha/beta/rc tags. -release = '0.5.4' +release = '0.5.4.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index 9b098c404..088abed48 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name='splinter', - version='0.5.4', + version='0.5.4.1', description='browser abstraction for web acceptance testing', long_description=README, author='CobraTeam', diff --git a/splinter/__init__.py b/splinter/__init__.py index e250e1fcf..132d1ec52 100644 --- a/splinter/__init__.py +++ b/splinter/__init__.py @@ -2,5 +2,5 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -__version__ = '0.5.4' +__version__ = '0.5.4.1' from splinter.browser import Browser