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

If you're using non-standard chrome version [Windows] #11

Open
rudolphos opened this issue Aug 4, 2019 · 2 comments
Open

If you're using non-standard chrome version [Windows] #11

rudolphos opened this issue Aug 4, 2019 · 2 comments

Comments

@rudolphos
Copy link

rudolphos commented Aug 4, 2019

You need to edit crawler.py script

binary_location - path to chromium browser
executable_path - for chromedriver.exe location

add

from selenium.webdriver.chrome.options import Options

options = webdriver.ChromeOptions()
options.binary_location = "C:\Program Files (x86)\Google\Chrome Dev\Application\chrome.exe"
driver = webdriver.Chrome(options = options, executable_path="chromedriver.exe")
driver.get('http://google.com/')
print("Chrome Browser Invoked")
driver.quit()

change after def generate_image (because chrome_options is deprecated)

from

    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
    chrome_options.add_argument('--headless')
    #chrome_options.add_argument('--disable-gpu')
    browser = webdriver.Chrome(options=chrome_options)

to

    options.add_experimental_option("mobileEmulation", mobile_emulation)
    options.add_argument('--headless')
    #chrome_options.add_argument('--disable-gpu')
    browser = webdriver.Chrome(options=options)

@piotrantosz
Copy link
Owner

piotrantosz commented Aug 4, 2019 via email

@rudolphos rudolphos changed the title If you're using non-standard chrome version If you're using non-standard chrome version [Windows] Aug 5, 2019
@rudolphos
Copy link
Author

It might break some things on other OSes.

options.binary_location = "" can be empty, then it selects default chrome installation, but leaving in executable_path="chromedriver.exe" might break script on linux.

This version is for windows, and only if chromedriver.exe is in the same folder as crawler.py.

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

2 participants