-
Notifications
You must be signed in to change notification settings - Fork 110
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
Cache Binaries #29
Comments
It looks like this gem hooks into Selenium here: With these patches: webdrivers/lib/webdrivers/selenium.rb Lines 3 to 7 in 645308c
So, in order to prevent unnecessary network requests, webdrivers/lib/webdrivers/common.rb Lines 10 to 31 in 645308c
It seems like this might cover all use cases without requiring network requests after the correct version has been installed: if correct_binary?
Webdrivers.logger.debug "Expected webdriver version found"
binary
elsif desired_version.nil?
raise "Unable to find the latest version of #{file_name}; try downloading manually from #{base_url} and place in #{install_dir}"
else
remove
download
end |
It's slightly trickier with the new chromedriver version matching, but I'm thinking a way to globally turn off auto updates probably needs to be supported, as well as checking the timestamp on the file and not making another network call if it is greater than a day (or user configurable period) old. Haven't had a chance to look at the current open PR yet which will influence what this needs to look like. |
Ah, yeah because Checking a timestamp to prevent the network requests could end up introducing bugs if the wait period coincides with a browser release. To work around that you could check the age of both the browser, and the driver. |
There's two steps now for chrome. Matching versions and ensuring latest point release. Probably not a big deal to be a day behind on a point release by default, so long as the versions are properly matched |
See also #4, another gotcha the network access leads to, involving Webmock. I understand the motivation for live checking for versions on every run in webdrivers. But for those who had been using chromedriver-helper without this feature without problems... I do think it would be nice if webdrivers should as an option provide a feature to work similar to chromedriver-helper, where it can use 'last known at time of release' versions without the network being involved. I'm also not sure what the implications of the network fetch are on CI runtimes on things like travis or circle-ci, perhaps I want to try to get travis to cache the location that webdrivers is going to be downloading to, hmm. |
@jrochkind I just submitted a PR that'll get you what you want - no network being involved. It'll allow you to pin down the desired version and limit the gem from updating the binary or performing any network checks until you:
Please see this spec for an example: https://github.com/titusfortner/webdrivers/pull/49/files#diff-dbad66b82ddd9a9fdd3e819d2421f77fR46 |
implemented with #104 |
Ideally each session shouldn't need to make a network call if the driver has been recently updated. Alternately if there's a way to programmatically establish the correct driver for the browser version and not unnecessarily check for updates.
The text was updated successfully, but these errors were encountered: