ultrafunkamsterdam / undetected-chromedriver

Custom Selenium Chromedriver | Zero-Config | Passes ALL bot mitigation systems (like Distil / Imperva/ Datadadome / CloudFlare IUAM)
https://github.com/UltrafunkAmsterdam/undetected-chromedriver
GNU General Public License v3.0
9.58k stars 1.14k forks source link

Cannot add extension crx file. help me #828

Open riiiiiiki opened 1 year ago

riiiiiiki commented 1 year ago

Hi! I can't add extensions crx file. Chrome always open but no extensions. did i do wrong somewhere? my code:

import undetected_chromedriver as uc
...
options = uc.ChromeOptions()
options.add_extension('./capcha.crx')
options.add_extension('./metamask.crx')
driver = uc.Chrome(use_subprocess=True,options = options,user_data_dir=path_profile_chrome)
Ansh-Fakesum commented 1 year ago

Just use the --load-extension= option to load a unpacked extension like:

import undetected_chromedriver as uc
import pathlib

options.add_argument(f"--load-extension="+",".join([
    str(pathlib.Path("./captcha").absolute()),
    str(pathlib.Path("./metamask").absolute())
]))

unpack the extensions here: https://www.ezyzip.com/open-extract-crx-file.html

ikapeykin commented 1 year ago

Hi, @Ansh-Fakesum.

Do you have a solution on how to prevent the extension page from opening? I wouldn't want to open the metamask page like there: image

Thanks! It will be helpful for me

ikapeykin commented 1 year ago
  prefs = {
      "extensions.ui.developer_mode": True,
  }
  options.add_experimental_option("prefs", prefs)

Ok, I got it :D

riiiiiiki commented 1 year ago

Chỉ cần sử dụng --load-extension=tùy chọn để tải tiện ích mở rộng đã giải nén như:

import undetected_chromedriver as uc
import pathlib

options.add_argument(f"--load-extension="+",".join([
    str(pathlib.Path("./captcha").absolute()),
    str(pathlib.Path("./metamask").absolute())
]))

giải nén các tiện ích mở rộng tại đây: https://www.ezyzip.com/open-extract-crx-file.html

Hi, I have successfully installed the add-on. but I have a problem that I can't open the settings page Capcha extension (metamask is still working properly). Can u help me (extension 2Capcha) image

riiiiiiki commented 1 year ago

Chỉ cần sử dụng --load-extension=tùy chọn để tải tiện ích mở rộng đã giải nén như:

import undetected_chromedriver as uc
import pathlib

options.add_argument(f"--load-extension="+",".join([
    str(pathlib.Path("./captcha").absolute()),
    str(pathlib.Path("./metamask").absolute())
]))

giải nén các tiện ích mở rộng tại đây: https://www.ezyzip.com/open-extract-crx-file.html

Hi, I have successfully installed the add-on. but I have a problem that I can't open the settings page Capcha extension (metamask is still working properly). Can u help me (extension 2Capcha) image

it's silly that i put the wrong path ^^ extension's id has been changed

Fakesum commented 1 year ago

you should get the chrome ids from the chrome://extensions page since the id when loaded unpacked does not stay contant for each device you use it on.

riiiiiiki commented 1 year ago

you should get the chrome ids from the chrome://extensions page since the id when loaded unpacked does not stay contant for each device you use it on.

can you teach me, pls Most of the documentation I've found is a guide to adding extensions to chrome. not talking about getting the extension id using selenium

riiiiiiki commented 1 year ago

you should get the chrome ids from the chrome://extensions page since the id when loaded unpacked does not stay contant for each device you use it on.

Hi. im trying to enable developer mode but it does not work. what am i wrong at? image image image

Fakesum commented 1 year ago

Please send the exception you are getting? the image cuts off before showing full traceback. there should be no need to enable devloper mode since you can get extension id from this one line: extension_id = driver.execute_script("""return document.querySelector("body > extensions-manager").shadowRoot.querySelector("#items-list").shadowRoot.querySelectorAll("extensions-item")[{placement}].id""") where placement is the index of the extension in chrome://extension page. this is always the same and sorted by name.

riiiiiiki commented 1 year ago

image

riiiiiiki commented 1 year ago

extension_id = driver.execute_script("""return document.querySelector("body > extensions-manager").shadowRoot.querySelector("#items-list").shadowRoot.querySelectorAll("extensions-item")[{placement}].id""")

This knowledge is starting to be more complicated than I imagined. This is not my area of expertise ^^ . I'm trying to learn on my own. I am so grateful for your teaching

M-Zubair10 commented 1 year ago

Just add extension manually in user_data_dir and load that data_dir in uc.Chrome object