-
-
Save cgoldberg/e6e2a1ef3535f8d614462cc42c935f33 to your computer and use it in GitHub Desktop.
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
unpacked_extension_path = '/path/to/unpacked/extension/' | |
options = Options() | |
options.add_argument('--load-extension={}'.format(unpacked_extension_path)) | |
driver = webdriver.Chrome(options=options) |
Would you tell me where i can find unpacked extensions? I was trying with packed extensions hola vpn crx, but it is not working? If you know how this can work, please guide me, Thank you.
https://launchpad.net/~canonical-chromium-builds/+archive/ubuntu/stage/+build/14482955
Cant remember - does that help ?
Once you move the .deb file over to raspberry pi - double click on it and it will self install.
anyone see any issues? working with the same code here, it loads the extension though shuts down immediately.... I tried running the code with "driver.implicit_wait(5)" and/or "driver.add_experimental_option=("detach", True)" to keep the browser open to get "https://www.google.com/"; Lines of code seem to be unread past "driver = webdriver.Chrome(options=options, executable_path=r'C:/Webdriver/chromedriver.exe')".
https://gyazo.com/342f031ad308767ef27a3576c6b91256
SCRIPT
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
unpacked_extension_path = 'C:/Users/Win_10/AppData/Local/Google/Chrome/User Data/Default/Extensions/ohjocgmpmlfahafbipehkhbaacoemojp/1.1.4_0/'
options = Options()
options.add_argument('--load-extension={}'.format(unpacked_extension_path))
driver = webdriver.Chrome(options=options, executable_path=r'C:/Webdriver/chromedriver.exe')
driver.get('https://www.google.com/')
ERROR
Traceback (most recent call last):
File "C:/Users/Win_10/AppData/Local/Programs/Python/Python38-32/winker.py", line 8, in
driver = webdriver.Chrome(options=options, executable_path=r'C:/Webdriver/chromedriver.exe')
File "C:\Users\Win_10\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in init
RemoteWebDriver.init(
File "C:\Users\Win_10\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in init
self.start_session(capabilities, browser_profile)
File "C:\Users\Win_10\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\Win_10\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Win_10\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created
from no such window: window was already closed
(Session info: chrome=83.0.4103.97)
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.common.exceptions import WebDriverException
chrome_options = webdriver.ChromeOptions()
driver = webdriver.Chrome(options=chrome_options,executable_path='/usr/lib/chromium-browser/chromedriver')
Throws a warning popup window which can not be dismissed.