DocNow / diffengine

track changes to the news, where news is anything with an RSS feed
MIT License
177 stars 30 forks source link

Configurable webdriver (gecko by default but now chrome can be chosen) #70

Closed nahuelhds closed 4 years ago

nahuelhds commented 4 years ago

I've added the chromedriver configurable with the config.yaml file.

You can configure this in the config.yaml. The keys are the following ones.

webdriver:
  engine:
  executable_path:
  binary_location:

Geckodriver

The geckodriver is properly defined by default. In case you need to configure it, then:

webdriver:
  engine: "geckodriver"
  executable_path: null (this config has no use with geckodriver)
  binary_location: null (the same as above with this one)

Chromedriver

If you want to use chromedriver locally, then you should leave the config this way:

webdriver:
  engine: "chromedriver"
  executable_path: null ("chromedriver" by default)
  binary_location: null ("" by default)

Using chromedriver in Heroku

If you use Heroku, then you have to add the Heroku chromedriver buildpack. And then use the environment vars provided automatically by it.

webdriver:
  engine: "chromedriver"
  executable_path: "${CHROMEDRIVER_PATH}"
  binary_location: "${GOOGLE_CHROME_BIN}"

This is added in the readme

edsu commented 4 years ago

Awesome! I tweaked the .travis.yml to hopefully get chromedriver installed on there so the test will pass.

edsu commented 4 years ago

There does seem to be a mismatch on Travis unfortunately. I will see if i can track it down, or disable to the test on Travis if I cant.

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f406e931cf8>

response = {'status': 500, 'value': '{"value":{"error":"session not created","message":"session not created: This version of ChromeDriver only supports Chrome version 80","stacktrace":"#0 0x558ae4d37e89 \\u003Cunknown>\\n"}}'}
nahuelhds commented 4 years ago

Ok. Let me know. Maybe I can help you with the debugging

nahuelhds commented 4 years ago

Hi @edsu I've seen you struggling with Chrome driver in Travis.

First of all, I see you could use the addon key as says the docs

addons:
  chrome: stable

If that doesn't work, then I think this could solve the issue as well. In this case, something like the following as we need Chrome v80

wget https://chromedriver.storage.googleapis.com/80.0.3987.106/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
./chromedriver

I don't know if this could be done directly on Travis.

Hope it helps.

edsu commented 4 years ago

It does help, thanks @nahuelhds -- I'll try those ideas out.

edsu commented 4 years ago

Bingo! addon works!