Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot add extension crx file. help me #828

Open
riiiiiiki opened this issue Oct 3, 2022 · 12 comments
Open

Cannot add extension crx file. help me #828

riiiiiiki opened this issue Oct 3, 2022 · 12 comments

Comments

@riiiiiiki
Copy link

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
Copy link

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
Copy link

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
Copy link

  prefs = {
      "extensions.ui.developer_mode": True,
  }
  options.add_experimental_option("prefs", prefs)

Ok, I got it :D

@riiiiiiki
Copy link
Author

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
Copy link
Author

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
Copy link

Fakesum commented Oct 6, 2022

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
Copy link
Author

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
Copy link
Author

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
Copy link

Fakesum commented Oct 7, 2022

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
Copy link
Author

image

@riiiiiiki
Copy link
Author

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants