Skip to content

Commit

Permalink
updated google colab pyvirtualdisplay
Browse files Browse the repository at this point in the history
  • Loading branch information
kaliiiiiiiiii committed Nov 28, 2022
1 parent 329ecbf commit ea59cc1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion src/selenium_profiles/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "2.2.3.2"
__version__ = "2.2.3.3"

from selenium_profiles.driver import driver, sendkeys, navigator2profile
6 changes: 0 additions & 6 deletions src/selenium_profiles/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions src/selenium_profiles/utils/colab_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))

0 comments on commit ea59cc1

Please sign in to comment.