DEV Community

MOMO
MOMO

Posted on

1 1

Answer: Loading .crx into remote chrome Selenium python

Here is an example to add an extension with Chrome with a remote server:

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_extension(r'C:\Downloads\Adblock-Plus_v1.11.crx')

capabilities = options.to_capabilities()
capabilities.update({'browser_version': '50.0', 'os': 'Windows', 'os_version': '10', 'resolution': '1366x768'})

driver = webdriver.Remote("http://127.0.0.1:4444/wd/hub", desired_capabilities=capabilities)
driver.get('http://stackoverflow.com/')

Note that it is preferable to set the Log level to WARNING

Top comments (0)

Jetbrains image

Build Secure, Ship Fast

Discover best practices to secure CI/CD without slowing down your pipeline.

Read more

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay