Closed alexanderadam closed 6 years ago
Selenium follows W3C WebDriver standard [1], so you can suggest [2] this feature to the standard, and if it's accepted there it will be eventually implemented in Selenium.
[1] https://w3c.github.io/webdriver/webdriver-spec.html [2] https://github.com/w3c/webdriver/issues
Okay, done. In case you (or someone else) want to support this: This issue number is 1234 and easily memorable. :wink:
Any idea how this is implemented in things like capybara? It sounds like a browser-specific feature, or perhaps some kind of proxy?
@shs96c was this a question a for me? I have no idea (in case it was). Currently a proxy isn't necessarily required in some of the Capybara drivers (poltergeist/phantomjs or capybara-webkit) support this already natively as mentioned above. And Chrome supports it as well natively but as far as I'm aware it is only possible to run Capybara on Chrome with the help of Selenium and Selenium as a driver doesn't support it (yet [as it seems <I'm still wondering>]).
A proxy would be a pragmatic solution and probably be necessary for, let's say, esoteric browsers but a "correct" and more flexible solution would probably be with request interception (Chrome, Firefox) which would indeed be browser specific. Libraries like ng-http-interceptor seem to have a generic approach though.
In case this functionality will be implemented with a proxy: It should probably not interfere with real proxy testing.
@shs96c It's not implemented in Capybara. As mentioned some of the drivers do provide black/whitelist functionality but it is driver specific. A solution that integrates with Capybara and works (or can be made to work) with all the drivers is the puffing-billy gem - https://github.com/oesmith/puffing-billy - which implements a programmable proxy. Also note that whitelisting
tends to be much more useful from a testing perspective than blacklisting URLs.
I'm pretty sure somebody must have created such ticket already or this features is already integrated but I can't find anything. So if it's a duplicated just close it please and point me to the right ticket. Thank you in advance!
However, I'm usually using selenium together with capybara and drivers (like for example
phantomjs
/poltergeist
withurl_blacklist
orcapyara-webkit
withblock_url
) support URL blocking.This makes sense for speeding up tests, blocking unwanted calls, testing how websites react when extensions (or something else) are blocking requests etc.
Also backends like chromedriver seem to support url blocking via
Network.setBlockedURLs
(or with request interception like phantomjs did).So I guess it would be nice to integrate this (in case it isn't implemented already anyway).
Thank you for your awesome work!
And again: I'm really sorry if this was opened before!