|
| 1 | +""" |
| 2 | +For use with SeleniumBase ad_block functionality. |
| 3 | +
|
| 4 | +Usage: |
| 5 | + On the command line: |
| 6 | + "pytest SOME_TEST.py --ad_block" |
| 7 | +
|
| 8 | + From inside a test: |
| 9 | + self.ad_block() |
| 10 | +
|
| 11 | +If using the command line version, the ad_block functionality gets |
| 12 | +activated after "self.wait_for_ready_state_complete()" is called, |
| 13 | +which is always run after page loads, unless changed in "settings.py". |
| 14 | +Using ad_block will slow down test runs a little. (Use only if necessary.) |
| 15 | +
|
| 16 | +Format: A CSS Selector that's ready for JavaScript's querySelectorAll() |
| 17 | +""" |
| 18 | + |
| 19 | +AD_BLOCK_LIST = [ |
| 20 | + '[aria-label="Ad"]', |
| 21 | + '[class^="sponsored-content"]', |
| 22 | + '[data-ad-details*="Advertisement"]', |
| 23 | + '[data-native_ad*="placement"]', |
| 24 | + '[data-provider="dianomi"]', |
| 25 | + '[data-type="ad"]', |
| 26 | + '[data-track-event-label*="-taboola-"]', |
| 27 | + '[href*="doubleclick.net/"]', |
| 28 | + '[id*="-ad-"]', |
| 29 | + '[id*="_ads_"]', |
| 30 | + '[id*="AdFrame"]', |
| 31 | + '[id^="ad-"]', |
| 32 | + '[id^="outbrain_widget"]', |
| 33 | + '[id^="taboola-"]', |
| 34 | + '[id="dianomiRightRail"]', |
| 35 | + '[src*="smartads."]', |
| 36 | + '[src*="ad_nexus"]', |
| 37 | + '[src*="/ads/"]', |
| 38 | + '[data-dcm-click-tracker*="/adclick."]', |
| 39 | + '[data-google-query-id^="C"]', |
| 40 | + 'div.ad-container', |
| 41 | + 'div.ad_module', |
| 42 | + 'div.ad-subnav-container', |
| 43 | + 'div.ad-wrapper', |
| 44 | + 'div.data-ad-container', |
| 45 | + 'div.l-ad', |
| 46 | + 'div.right-ad', |
| 47 | + 'div.wx-adWrapper', |
| 48 | + 'img.img_ad', |
| 49 | + 'link[href*="/adservice."]', |
| 50 | + 'script[src*="/adservice."]', |
| 51 | + 'script[src*="/pagead/"]', |
| 52 | + 'section.dianomi-ad', |
| 53 | +] |
0 commit comments