From afc6f965759da3b481030f2292ee70bac52c4f20 Mon Sep 17 00:00:00 2001 From: Vincent Ardisson Date: Tue, 14 Aug 2018 11:56:26 +0200 Subject: [PATCH] weboob.browser.selenium: allow changing rendering window size This can be useful for responsive sites. --- weboob/browser/selenium.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/weboob/browser/selenium.py b/weboob/browser/selenium.py index a4eedb4544..3885b0eab8 100644 --- a/weboob/browser/selenium.py +++ b/weboob/browser/selenium.py @@ -403,6 +403,14 @@ class SeleniumBrowser(object): """Default wait time for `wait_*` methods""" + WINDOW_SIZE = None + + """Rendering window size + + It can be useful for responsive websites which show or hide elements depending + on the viewport size. + """ + BASEURL = None MAX_SAVED_RESPONSES = (1 << 30) # limit to 1GiB @@ -475,6 +483,9 @@ def _setup_driver(self): else: raise NotImplementedError() + if self.WINDOW_SIZE: + self.driver.set_window_size(*self.WINDOW_SIZE) + ### Browser def deinit(self): if self.driver: -- GitLab