gologinapp / pygologin

REST API provides programmatic access to GoLogin App. Create a new browser profile, get a list of all browser profiles, add a browser profile and running
Other
65 stars 41 forks source link

Can I use chrome extensions? #40

Closed choseenonee closed 1 year ago

choseenonee commented 1 year ago

I want to interact with chrome-extension and I've checked this for usual Selenium and Chrome and its working, but when I'm trying to do this with the following code, I encounter a ERR_BLOCKED_BY_CLIENT. I would be very happy if you know how to fix that! image

here is my code: from sys import platform from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service from gologin import GoLogin import time

gl = GoLogin({ 'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2NGJlOTAwZjE2ODg2MTZlOTVlMmJiZGYiLCJ0eXBlIjoiZGV2Iiwiand0aWQiOiI2NGJlOTBhOWMxZDcxZDZjYThkYjJlOGIifQ.N03IIvbpUx3hlTnHBpM78jWW2-2hBV64TJKAg97_49Q', 'profile_id': '64bed9edc1d71d4a0afc28d1', })

if platform == "linux" or platform == "linux2": chrome_driver_path = './chromedriver' elif platform == "darwin": chrome_driver_path = './mac/chromedriver' elif platform == "win32": chrome_driver_path = 'chromedriver.exe'

service = Service(chrome_driver_path)

debugger_address = gl.start() chrome_options = Options() path = 'app.crx' chrome_options.add_extension(path) chrome_options.add_experimental_option("debuggerAddress", debugger_address) driver = webdriver.Chrome(service=service, options=chrome_options) url = 'chrome-extension://ojggmchlghnjlapmfbnjholfjkiidbch/home.html' driver.get(url) time.sleep(30) driver.quit()