-
Notifications
You must be signed in to change notification settings - Fork 205
URL blocking / ad blocking #1234
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
Comments
I’m not entirely certain what this issue is regarding? |
I guess defining a standardized way of blocking elements in user agents. I'm not sure how this would look like as well but @barancev suggested opening an issue for webdriver regarding content blocking and I thought you folks might rather know what to do. 😉 |
We can certainly consider it, but I’m not sure there’s a good way of defining what it means to block a URL in web platform terms. It might be possible for resources loaded in HTML, but not generally for any UA resource. |
I'm not sure how meaningful this is. Most of the drivers out there allow you to install extensions (such as adblockers), so there's no need to bake it into this specification. There are some browsers implementing some form of cookie control or adblocking, and the developers of those browsers can use this spec "as is". |
Going to add to this conversation with the why? (for me). I think this blog post from ThoughtBot does a really good job of explaining why we might want this feature. |
This comment has been minimized.
This comment has been minimized.
My use case is about blocking a ridiculously huge background image. The test suite has to download it over and over again. |
|
What I could imagine is that the driver would map urls to different resources. This way the test could use a test version of JS, download lighter static content from a local source, similar to mocking by simulation of an external source... |
This would also make testing of offline functionality in PWAs much more easy. In my specific case, I've wrapped all my |
Just use --host-resolver-rules for chrome. |
This repository is not about certain ways to achieve this with a particular driver. |
It's 2024 now and I stopped using Selenium in all of my projects and switched to other drivers. Or how it's put in this article:
And while blocking ads was mainly just supported via extensions when I created this issue in 2018, it is nowadays even integrated natively in certain user agents. |
@alexanderadam In WebDriver BiDi we allow to add network interceptions which can be used to block certain network requests and as such for blocking elements to be loaded at all. Does that satisfy your needs? Please note that such a feature cannot be done for the WebDriver classic protocol due to limitations of the protocol. |
I'm going to close this issue in favor of the mentioned network interception feature of WebDriver BiDi. If that doesn't fit your needs please explain what's missing. Thanks. |
It might be relevant for others that this might also overlap with webdriver bidi issue 403, which is about extensions and this is the usual way of having adblocking functionality in users browser. It's still a pity that it took so long although browser extension were introduced with Firefox in 2004, there was no real webdriver specification for most of its existence until this PR in 2023. But I guess better late than never. 😉 |
Please note that there is also a way for WebDriver classic to install addons. It's just not part of the specification and each vendor handles it via extension commands. So the benefit with BiDi is that the command is now officially spec'ed. |
Uh oh!
There was an error while loading. Please reload this page.
The webdriver standard represents a part of the web testing activity. And developers want to test things that are common things that happen in the real life.
One of the most common things in the web is, that people control is the display of ads (or other elements / scripts such as webminers) with the help of adblockers like uBlock Origin and similar ones. Browsers like Firefox, Google Chrome and Chromium, Brave, Safari or Opera even have functionality like this integrated natively (the same goes for many testing solutions, i.e. when using Chrome 84 or newer or puppeteer).
Since this is so common, it should obviously be tested properly. Developers want to know how an application or website reacts when people are visiting it with adblock functionality enabled.
That is why I believe it should be integrated in the webdriver standard as well.
The text was updated successfully, but these errors were encountered: