From 1727de33bb012696bd64d237796222ee17688392 Mon Sep 17 00:00:00 2001 From: Roman Konoval Date: Wed, 18 Jul 2018 10:02:14 +0200 Subject: [PATCH 1/2] logs only js errors, not console log due to firefox issue https://github.com/mozilla/geckodriver/issues/284 --- src/sst/actions.py | 4 ++++ src/sst/browsers.py | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/sst/actions.py b/src/sst/actions.py index f12da9b..9f79676 100644 --- a/src/sst/actions.py +++ b/src/sst/actions.py @@ -1790,3 +1790,7 @@ def get_element_source(id_or_elem): """ elem = _get_elem(id_or_elem) return elem.get_attribute('innerHTML') + +def get_browser_log(): + import ipdb; ipdb.set_trace() + return _test.browser.get_log('browser') diff --git a/src/sst/browsers.py b/src/sst/browsers.py index f45f442..60c4d71 100644 --- a/src/sst/browsers.py +++ b/src/sst/browsers.py @@ -83,6 +83,12 @@ class ChromeFactory(BrowserFactory): webdriver_class = webdriver.Chrome + def browser(self): + from selenium.webdriver.common.desired_capabilities import DesiredCapabilities + desired = DesiredCapabilities.CHROME + desired['loggingPrefs'] = { 'browser':'ALL' } + return self.webdriver_class(self.profile, capabilities=desired) + # MISSINGTEST: Exercise this class (requires windows) -- vila 2013-04-11 class IeFactory(BrowserFactory): @@ -209,7 +215,10 @@ def setup_for_test(self, test): self.profile = profile def browser(self): - return self.webdriver_class(self.profile) + from selenium.webdriver.common.desired_capabilities import DesiredCapabilities + desired = DesiredCapabilities.FIREFOX + desired['loggingPrefs'] = { 'browser':'ALL' } + return self.webdriver_class(self.profile, capabilities=desired) # MISSINGTEST: Exercise this class -- vila 2013-04-11 From 6e2f6f2a2a23bf2dc9b944e498a752806f6b4457 Mon Sep 17 00:00:00 2001 From: Roman Konoval Date: Wed, 18 Jul 2018 11:41:24 +0200 Subject: [PATCH 2/2] clean up and version update --- src/sst/__init__.py | 2 +- src/sst/actions.py | 2 +- src/sst/browsers.py | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/sst/__init__.py b/src/sst/__init__.py index 28908e3..8eafcbb 100644 --- a/src/sst/__init__.py +++ b/src/sst/__init__.py @@ -18,7 +18,7 @@ # -__version__ = '0.2.9.5' +__version__ = '0.2.9.6' DEVSERVER_PORT = 8120 # django devserver for internal acceptance tests diff --git a/src/sst/actions.py b/src/sst/actions.py index 9f79676..2699d5e 100644 --- a/src/sst/actions.py +++ b/src/sst/actions.py @@ -1791,6 +1791,6 @@ def get_element_source(id_or_elem): elem = _get_elem(id_or_elem) return elem.get_attribute('innerHTML') + def get_browser_log(): - import ipdb; ipdb.set_trace() return _test.browser.get_log('browser') diff --git a/src/sst/browsers.py b/src/sst/browsers.py index 60c4d71..b4dea7f 100644 --- a/src/sst/browsers.py +++ b/src/sst/browsers.py @@ -26,6 +26,7 @@ from selenium import webdriver from selenium.common import exceptions as selenium_exceptions from selenium.webdriver.common import utils +from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from selenium.webdriver.firefox import ( firefox_binary, webdriver as ff_webdriver, @@ -84,7 +85,6 @@ class ChromeFactory(BrowserFactory): webdriver_class = webdriver.Chrome def browser(self): - from selenium.webdriver.common.desired_capabilities import DesiredCapabilities desired = DesiredCapabilities.CHROME desired['loggingPrefs'] = { 'browser':'ALL' } return self.webdriver_class(self.profile, capabilities=desired) @@ -100,7 +100,7 @@ class IeFactory(BrowserFactory): class PhantomJSFactory(BrowserFactory): webdriver_class = webdriver.PhantomJS - + def browser(self): return self.webdriver_class(service_args=['--ignore-ssl-errors=true']) @@ -215,7 +215,6 @@ def setup_for_test(self, test): self.profile = profile def browser(self): - from selenium.webdriver.common.desired_capabilities import DesiredCapabilities desired = DesiredCapabilities.FIREFOX desired['loggingPrefs'] = { 'browser':'ALL' } return self.webdriver_class(self.profile, capabilities=desired)