From ea59cc112d7348ae6b18bcb8058f14445e719bca Mon Sep 17 00:00:00 2001 From: kaliiiiiiiiiii Date: Mon, 28 Nov 2022 17:05:16 +0100 Subject: [PATCH] updated google colab pyvirtualdisplay --- README.md | 7 +++++-- src/selenium_profiles/__init__.py | 2 +- src/selenium_profiles/driver.py | 6 ------ src/selenium_profiles/utils/colab_utils.py | 8 ++++++++ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f940dbc..6aed3bb 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,9 @@ Don't forget to execute ```driver.quit()``` in the End. Else-wise your temporary folder will get flooded! (Windows) +#### Using Google-Colab +see [Google-Colab]() + ## Profiles Example Profile: @@ -123,7 +126,7 @@ Please feel free to open an issue or fork! - [x] [modheader]((https://github.com/modheader/modheader_selenium)) - [ ] [chromedriver](https://chromedriver.chromium.org/downloads) - [x] Windows - - [ ] Jupyter + - [x] Jupyter (Google-Colab) - [ ] Linux (not tested yet!) - [ ] [Chrome-Browser](https://www.google.de/chrome/)s - [ ] requirements.txt @@ -153,7 +156,7 @@ Please feel free to open an issue or fork! - [x] Rewrite driver.py to V2.2 - [ ] support for - [x] Windows - - [ ] Jupyter Notebook (Already prototype) + - [x] Jupyter Notebook (Google-Colab) - [ ] Linux diff --git a/src/selenium_profiles/__init__.py b/src/selenium_profiles/__init__.py index da6f52d..2b5eac4 100644 --- a/src/selenium_profiles/__init__.py +++ b/src/selenium_profiles/__init__.py @@ -1,3 +1,3 @@ -__version__ = "2.2.3.2" +__version__ = "2.2.3.3" from selenium_profiles.driver import driver, sendkeys, navigator2profile diff --git a/src/selenium_profiles/driver.py b/src/selenium_profiles/driver.py index b56c3b7..dd1cdfa 100644 --- a/src/selenium_profiles/driver.py +++ b/src/selenium_profiles/driver.py @@ -108,12 +108,6 @@ def start(self, profile: Dict[str, dict or list]): install_buster() options.add_argument('--load-extension=' + sel_profiles_path() + "files/buster") - if is_collab(): - from selenium_profiles.utils.colab_utils import display - display = display() - self.display = display - self.display.start_display() # todo: stop display missing! - # Actual start of chrome self.driver = uc.Chrome(use_subprocess=True, options=options, keep_alive=True, browser_executable_path=find_chrome_executable()) # start undetected_chromedriver diff --git a/src/selenium_profiles/utils/colab_utils.py b/src/selenium_profiles/utils/colab_utils.py index ab099a7..f437453 100644 --- a/src/selenium_profiles/utils/colab_utils.py +++ b/src/selenium_profiles/utils/colab_utils.py @@ -71,3 +71,11 @@ def start_display(self, x=1200, y=2200): def stop_display(self): self.display.stop() + + +# noinspection PyUnresolvedReferences,PyPackageRequirements +def showscreen(driver): + from IPython.display import display as imagerender + from IPython.display import Image + driver.save_screenshot('screen.png') + imagerender(Image('screen.png'))