0

I want to add the plugin called metamask to my browser and check the amount of etherium in my wallet. But when I add the plugin, sometimes I get this error and sometimes I don't:

selenium.common.exceptions.WebDriverException: Message: unknown error: failed to wait for extension 
background page to load: chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background.html
from timeout: Timed out receiving message from renderer: 10.000

here is my basic code:

extension = r'C:\Users\ozguc\Downloads\extension_10_8_1_0.crx'
options = webdriver.ChromeOptions()
options.add_argument('--disable-gpu')
options.add_argument("--force-device-scale-factor=1")
options.add_argument("--enable-features=NetworkServiceInProcess")
options.add_extension(extension)
try:
    driver = webdriver.Chrome(r"chromedriver.exe", chrome_options=options)

Im not using headless chrome,thanks

  • I would try without "--disable-gpu" tag. (btw, this sounds like a bad idea security-wise... remember that Selenium is running outside of the sandbox here... you should be very sure that you only visit sites you absolutely trust when enabling this extension in a Selenium session.) – pcalkins Dec 27 '21 at 22:50
  • Adding it didn't work for me, sir : options.add_argument('--no-sandbox') – Emrovsky Emrovsky Dec 28 '21 at 16:12
  • adding "no-sandbox" would make things worse security-wise. So removing the disable-gpu option didn't help? – pcalkins Dec 28 '21 at 18:49

1 Answers1

4

In official google chrome support for chrome driver there were some suggestions for python to use options.add_experimental_option('extensionLoadTimeout', 60000) the putting time set's in milliseconds, so 60k will be 1 minute.

This fixes the problem of timeout for slow PC. I fixed the same issue with metamask.

innicoder
  • 2,612
  • 3
  • 14
  • 29
uyau
  • 66
  • 3