Closed canonsky1992 closed 3 years ago
@ultrafunkamsterdam hi thanks for chromedriver. I also cannot add an extension. Is this a bug? @ultrafunkamsterdam extensions work for you?
No. Extensions do not work in combination with remote debugging (which is used by this module).
got it. maybe there is some way out to add auth proxy? (I tried seleniumwire - there is a problem with mitmproxy that changes fingerprint and cloudflare returns 503 error. I also thought about an extension that would help with a proxy - but remote debugging does not work with the extension). you have more knowledge - is there any way out? v2 works fine, but damn I need to work with auth proxy
Fingerprint is not a network thing so mitm proxy wouldn't change it. That's for sure 😉
well i don't have enough knowledge, and i read this there mitm and selenium-wire.
no solutions at all?( What happens if remove remote debugging? won't bypass cloudflare? (remove for the ability to install extensions with auth proxy)
@ultrafunkamsterdam Sorry to bother you, I guess I'm already bored you) I found a couple of possibilities 1 and 2 (use --load-extension to load the extension for the remote debugging browser, this line with arguments), I tried but got an error ERR_SOCKS_CONNECTION_FAILED
. I wanted to ask if you tried this? if not, is there a chance that it will help?
You can definitly add extensions. But you'll need a steady profile as extensions are kept in the profile.
I've managed to load extensions by extracting the CRX file into a folder and then using --load-extension
.
I've managed to load extensions by extracting the CRX file into a folder and then using
--load-extension
.
Hello @the-white-light , can you elaborate how you approached it with --load-extension
?
I have the following code, doesn't work:
options.add_argument('--load-extension = C:\Code\project_MP\ABC.crx')
Can you kindly explain in detail how this works? a sample code will be much appreciated.
Thanks
You had it mostly right, but as I said before you need to extract the extension first, then direct the code to the destination folder.
I extracted the .crx file to ./MultiPass
and then did opt.add_argument('--load-extension=./MultiPass')
You had it mostly right, but as I said before you need to extract the extension first, then direct the code to the destination folder.
I extracted the .crx file to
./MultiPass
and then didopt.add_argument('--load-extension=./MultiPass')
@the-white-light yes, I have extracted the extension into .crx file and saved in the same directory(folder):
options.add_argument('--load-extension = ./ABC.crx')
tried it...still doesn't work. Here is my entire code:
import undetected_chromedriver as uc import time from selenium import webdriver from selenium.webdriver.common.by import By
def main(): options = uc.ChromeOptions() options.add_argument("--no-sandbox --no-first-run --no-service-autorun --password-store=basic") driver = uc.Chrome(options=options) options.add_experimental_option('excludeSwitches', ['enable-logging']) options.add_argument('--load-extension = ./abc.crx')
if name == 'main': main()
Please re-read what I wrote. You need to extract the crx, and it is not used in the code. You downloaded the crx file, which is basically just a zip file. Extract it then point your code to the destination folder.
Please re-read what I wrote. You need to extract the crx, and it is not used in the code. You downloaded the crx file, which is basically just a zip file. Extract it then point your code to the destination folder.
did that.
options
after initializing the chromedriver, it needs to be before the driver =
line. 2. er initializing the chro
@the-white-light thanks, my mistake. does the .crx file needs to be the only file in the subfolder?
No, you just extract it into a folder and point your code to that.
No, you just extract it into a folder and point your code to that.
damn, found it, but got this error instead...the .crx file should be fine since I just used it in a headless browser test...let me try something else
No, you just extract it into a folder and point your code to that.
damn, found it, but got this error instead...the .crx file should be fine since I just used it in a headless browser test...let me try something else
hey mate, did you solve this error? i also can not add extension.
I know it's late to add this comment but it might help someone in the future. When you extract the extension, point your code to the full path of the extracted folder like C:\Users\yourproject\extension
It worked for me!!!
i found the soultion of this
No, you just extract it into a folder and point your code to that.
damn, found it, but got this error instead...the .crx file should be fine since I just used it in a headless browser test...let me try something else
hey mate, did you solve this error? i also can not add extension.
i got the solution using this.. try download the extension as zip.. then extract to some folder
then you can options.add_argument('--load-extension = ./extraction_folder')
should not .crx file
i found the soultion of this
No, you just extract it into a folder and point your code to that.
damn, found it, but got this error instead...the .crx file should be fine since I just used it in a headless browser test...let me try something else
hey mate, did you solve this error? i also can not add extension.
i got the solution using this.. try download the extension as zip.. then extract to some folder
then you can options.add_argument('--load-extension = ./extraction_folder')
should not .crx file
hi mate, i can kindly share a sample code, i try but still get error. I newbie in python selenium, tks for your help Here my code: from selenium.webdriver.common import keys import undetected_chromedriver.v2 as uc import time if name == 'main': options = uc.ChromeOptions() options.add_argument("--disable-notifications") options.add_argument('--load-extension =C:\python\myproject\Extract file') # extract file zip to directory
options.user_data_dir = "c:\\temp\\profile18"
driver = uc.Chrome(options=options,version_main=97)
time.sleep(2)
input('ok')
ext ├── pass │  ├── 47a1591dea3b6d1f42f9b3cd0673f69c.svg │  ├── background.js │  ├── icons │  │  ├── 128 │  │  │  ├── gold.png │  │  │  └── grey.png │  │  ├── 32 │  │  │  ├── gold.png │  │  │  └── grey.png │  │  ├── 48 │  │  │  ├── gold.png │  │  │  └── grey.png │  │  └── 64 │  │  ├── gold.png │  │  └── grey.png │  ├── manifest.json │  ├── popup.css │  ├── popup.html │  └── popup.js └── solver ├── content │  ├── hcaptcha.js │  ├── model.js │  └── tf.js ├── images │  ├── icon_128.png │  ├── icon_16.png │  ├── icon_32.png │  └── icon_48.png ├── manifest.json ├── model │  ├── group1-shard1of5 │  ├── group1-shard2of5 │  ├── group1-shard3of5 │  ├── group1-shard4of5 │  ├── group1-shard5of5 │  └── model.json └── worker.js
ext is root folder of extension.. inside ext folder pass and solver are extracted extension then load the extension like this
options.add_argument('--load-extension=./ext/solver,./ext/pass')
i use 2 extension here, so is separated by coma in argument
i found the soultion of this
No, you just extract it into a folder and point your code to that.
damn, found it, but got this error instead...the .crx file should be fine since I just used it in a headless browser test...let me try something else
hey mate, did you solve this error? i also can not add extension.
i got the solution using this.. try download the extension as zip.. then extract to some folder then you can options.add_argument('--load-extension = ./extraction_folder') should not .crx file
hi mate, i can kindly share a sample code, i try but still get error. I newbie in python selenium, tks for your help Here my code: from selenium.webdriver.common import keys import undetected_chromedriver.v2 as uc import time if name == 'main': options = uc.ChromeOptions() options.add_argument("--disable-notifications") options.add_argument('--load-extension =C:\python\myproject\Extract file') # extract file zip to directory # setting profile options.user_data_dir = "c:\temp\profile18" driver = uc.Chrome(options=options,version_main=97) time.sleep(2) input('ok')
chrome_options = Options() chrome_options.add_argument('user-data-dir='+profiles[i]) chrome_options.add_extension('data/exten.crx') driver = uc.Chrome(options=chrome_options) Why v2 cannot add extension?