How can I use a Google Chrome extension with Selenium?
Question: I am trying to scrape match information from the a page like this one (page is
in the same format, but obviously has different values for different matches):
<https://csgolounge.com/match?m=8967>

The problem is, the information that I want is only displayed if you are using
the Chrome extension, "Lounge Destroyer"... After tons of trial and error, I
finally figured out that in order to get that information, the python script I
use has to have that extension "included in it" somehow. I have browsed other
answers here and found this code from a different stackoverflow thread that
demonstrates how to add an extension when using selenium:

    
    
                from selenium import webdriver
                from selenium.webdriver.chrome.options import Options
    
                chop = webdriver.ChromeOptions()
                chop.add_extension('Adblock-Plus_v1.4.1.crx')
                driver = webdriver.Chrome(chrome_options = chop)
    

I went to [Chrome Extension Downloader](http://chrome-extension-
downloader.com/) to snag the .crx file for LoungeDestroyer, placed it in the
chrome extension folder (getting the file address from "Get Info"), and
modified the above code a little bit for my purposes to get the following:

    
    
                from selenium import webdriver
                from selenium.webdriver.chrome.options import Options
    
                chop = webdriver.ChromeOptions()
                chop.add_extension('Users/Username_Here/Library/Application Support/Google/Chrome/Default/Extensions/ghahcnmfjfckcedfajbhekgknjdplfcl/LoungeDestroyer_v0.9.3.7.crx')
                driver = webdriver.Chrome(chrome_options = chop)
    
                matchID = raw_input("Enter match ID (four digit number in CSGL URL): ")
                driver.get("https://csgolounge.com/match?m="+matchID)
    

The problem is, I don't think I've substituted the right thing where the
'Adblock-Plus_v1.4.1.crx' was in the original code.

Running my modified version returns the following error:

    
    
                IOError: Path to the extension doesn't exist
    

Any help or advice is greatly, greatly appreciated.


Answer: The problem was that I didn't have chromedriver installed
(<http://chromedriver.storage.googleapis.com/index.html?path=2.21/>). After
installing that, I had to enter the path to the chromedriver executable in my
code. All said and done, this was the code that worked:

    
    
                from selenium import webdriver
                from selenium.webdriver.chrome.options import Options
    
    
                chop = webdriver.ChromeOptions()
                chop.add_extension('/Users/Username_Here/Library/Application Support/Google/Chrome/Default/Extensions/ghahcnmfjfckcedfajbhekgknjdplfcl/LoungeDestroyer_v0.9.3.7.crx')
                driver = webdriver.Chrome(executable_path='/Users/Username_Here/Downloads/chromedriver', chrome_options = chop)
    
                # go to the match page
                matchID = raw_input("Enter match ID (four digit number in CSGL URL): ")
                driver.get("https://csgolounge.com/match?m="+matchID)
    

Also, the reason I was getting that extension-path error was because I didn't
have the forward slash in front of the word "Users" in the file address.

