Open rwguerra opened 2 years ago
Is is possible to post the error message and some other pertinent details(software versions, system) to attempt a simulation of your problem?
I have the same issue attempting to install a Webrtc blocker. Here is my snippet:
import seleniumwire.undetected_chromedriver.v2 as uc
options = uc.ChromeOptions()
options.add_argument('--no-first-run --no-service-autorun --password-store=basic')
options.add_argument('--data-path={}'.format(os.getcwd() + '/chrome-data/data-path'))
chrome_options.add_extension(webrtc_blocker.crx)
driver = uc.Chrome(options=options)
This is the environment I use:
There are no errors. The extension just doesnt install anymore
I can confirm. Works in vanilla chrome driver and v1. Not v2. I can see it passed in chrome options when loading. Looking into the code to see if I can see where/how it is getting dropped.
Had to fallback to v1 too. Any news?
p.s. this repo is some impressing work. Does anybody knows where I can donate? I didn't find any reference
used --load-extension in arguments
Bug here v2.py:300
temporal fix
https://stackoverflow.com/questions/20782557/load-unpacked-chrome-extension-programmatically
I have the same issue @ultrafunkamsterdam
I just had some time to come back to this and have had little success getting it to work in v2 still. I went back to try to look at all commits since v1 to see what might have changed and it is quite a lot. In that time, @ultrafunkamsterdam has done extensive work.
I noticed this comment on the original 3.0 PR suggesting it has something to do with the new way the user profile directory is handled, but so far even forcing the extension in that directory gets it picked up, i.e. I can see the encoded bytes passed in with goog:chromeOptions when launching, but it does not register in the browser when it opens.
My use case is that I am trying to install a webrtc blocker so that it is not apparent that we are running on a proxy and the local ip is not leaked.
@ultrafunkamsterdam I know you are very busy, but if you have any guidance about what specifically changed to prevent extensions from working in v2, your guidance would be greatly appreciated!
+1 I have the same issue @ultrafunkamsterdam
used --load-extension in arguments
Bug here v2.py:300
temporal fix
https://stackoverflow.com/questions/20782557/load-unpacked-chrome-extension-programmatically
Hello, can you kindly elaborate how to it works with "used --load-extension in arguments"? I used the following code, doesn't seem to install the browser extension. no error though.
options.add_argument('--load-extension = C:\Code\project_MP\abc.crx')
+1 I have the same issue.
used --load-extension in arguments Bug here v2.py:300 temporal fix https://stackoverflow.com/questions/20782557/load-unpacked-chrome-extension-programmatically
Hello, can you kindly elaborate how to it works with "used --load-extension in arguments"? I used the following code, doesn't seem to install the browser extension. no error though.
options.add_argument('--load-extension = C:\Code\project_MP\abc.crx')
I tried this as well and it gives me an error that the extension can not be loaded and or is missing a manifest file.. The same extension works with the vanilla chrome driver but installing it does not work on v1 and v2. I can however install the same extension through the chrome store and it works in v1 browser. I'm trying to automate the install as well
edit: figured it out for v1...
1) Download the extension source. e.g: https://github.com/MetaMask/metamask-extension/releases
Use the chrome settings
2) extract the zip to some directory
3) Load the directory (do not use an absolute path to a .crx
file, that did not work for me)
import undetected_chromedriver as uc
chrome_options = uc.ChromeOptions()
chrome_options.add_argument('--load-extension=/Users/kpearson/Programs/misc/selenium/metamask-chrome-10.8.2')
self.driver = uc.Chrome(
version=96,
options=chrome_options)
@pearsonkyle How do you use v1? It seems like v1 can no longer be used, because "import undetected_chromedriver as uc" is the same now as "import undetected_chromedriver.v2 as uc"
issue still exists
Owner @ultrafunkamsterdam replied with this in another issue:
Do extensions work or no!?
Same issue here...my use case requires the metamask extension and I am not sure how I can load that into the uc driver... (works fine with standard selenium chromedriver)
import undetected_chromedriver.v2 as uc
Any idea how to add more than 1 extension? with this option "opts.add_argument("--load-extension=/Path/To/Your/Extention/Folder")" it's only possible to add 1 extension
I actually had 2 extensions in my app. So it should be possible. Just try to add them one after another
"opts.add_argument("--load-extension=/Path/To/Your/Extention1/Folder")"
"opts.add_argument("--load-extension=/Path/To/Your/Extention2/Folder")"
Are you sure it's working for you? When I tried your example it loaded just the last argument ("opts.add_argument("--load-extension=/Path/To/Your/Extention2/Folder")")
Sorry for being a bit confusing. Sure, i did it, but unfortunately i can not find where my code is. I also suggest you to try this way:
opts.add_argument("--load-extension=/path/to/Extension/,/path/to/Extension2/")
Sorry for being a bit confusing. Sure, i did it, but unfortunately i can not find where my code is. I also suggest you to try this way:
opts.add_argument("--load-extension=/path/to/Extension/,/path/to/Extension2/")
tested it .. not working. Thanks for trying to help!
Found some code. Which opens google chrome using undetected chromedriver. (only had to update webdriver to 108 version). I can share my code of init_driver function where i upload those extensions
def init_driver(browser): screen_width = 1700 screen_height = 700 if int(browser) > 10 else 0 ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586" opts = uc.ChromeOptions() opts.add_argument("--window-size=150,700") opts.add_argument("--disable-blink-features=AutomationControlled") #opts.add_argument("--disable-features=UserAgentClientHint") opts.add_argument("--user-agent="+ua) opts.add_argument("--load-extension=./../TamperMonkey/,./../Browsec/") opts.add_argument("--ignore-certificate-errors") opts.add_argument("--disable-site-isolation-trials") opts.add_experimental_option('prefs', { 'enable_do_not_track': True }) driver = uc.Chrome(options=opts, subprocess=True, driver_executable_path=driverpath) driver.get('chrome-extension://'+tampermonkey+'/options.html#nav=new-user-script+editor') original_window = driver.current_window_handle return driver, original_window
Ok, I got it. Thank you for your help!
Did anyone found a option to load two extensions at same time ?
I have 1 metamask extension and 1 for my private proxy (its password protected so have to use extension to enter password)
I am able to add 2 extensions in Undected Chrome in normal one its running fine but not in undected chrome
Did anyone found a option to load two extensions at same time ?
I have 1 metamask extension and 1 for my private proxy (its password protected so have to use extension to enter password)
I am able to add 2 extensions in Undected Chrome in normal one its running fine but not in undected chrome
If someone is facing the same problem you can chain multiple extensions at the same time (Notice the ",") :
opts.add_argument("--load-extension=./ext1,./ext2")
Using this is not working for me (only the first one is loaded) :
opts.add_argument("--load-extension=./ext1")
opts.add_argument("--load-extension=./ext2")
找到一些代码。这会使用未检测到的浏览器驱动程序打开谷歌浏览器。(只需要将网络驱动程序更新到 108 版本)。我可以在上传这些扩展名的地方分享我的init_driver函数代码
def init_driver(browser): screen_width = 1700 screen_height = 700 if int(browser) > 10 else 0 ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586" opts = uc.ChromeOptions() opts.add_argument("--window-size=150,700") opts.add_argument("--disable-blink-features=AutomationControlled") #opts.add_argument("--disable-features=UserAgentClientHint") opts.add_argument("--user-agent="+ua) opts.add_argument("--load-extension=./../TamperMonkey/,./../Browsec/") opts.add_argument("--ignore-certificate-errors") opts.add_argument("--disable-site-isolation-trials") opts.add_experimental_option('prefs', { 'enable_do_not_track': True }) driver = uc.Chrome(options=opts, subprocess=True, driver_executable_path=driverpath) driver.get('chrome-extension://'+tampermonkey+'/options.html#nav=new-user-script+editor') original_window = driver.current_window_handle return driver, original_window
this work for me !
Hello guys!
Im trying to add extension into V2 but its not working... when I do using "V1" it works properly
How can I put it to work?
This is the "v1" code that works
This is the v2 code that DOSNT work