'Selenium Python timed out receiving message from renderer error

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



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 innicoder