![]() |
Request blocking in Chrome Incognito mode - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Request blocking in Chrome Incognito mode (/thread-30753.html) |
Request blocking in Chrome Incognito mode - pyseeker - Nov-04-2020 Hello, We have a requirement to block various social media apps browsing using the Chrome Browser (Incognito mode because it does not retain cache). There are about 100 apps that we are currently testing by manually inserting social media app urls in the 'Enable request blocking' feature from Developer Tools. When tested manually, the block works, which means if I insert a url say : "https://www.twitter.com", twitter page is not loaded and displayed. However, when I run the script below having the block on in the browser developer tools, the block is not applied and the twitter page is displayed. Steps : 1. Open the browser in incognito mode. 2. Open the Developer tools and enable block requests and add urls in 'Enable request blocking'. 3. run the following simple py script. Observation is, the page loads successfully. My expectation is, since the url is already blocked in dev tools, I would like to see page is blocked, but the block above was never applied and page loaded successfully. import webbrowser url = 'https://www.twitter.com/' chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s --incognito' webbrowser.get(chrome_path).open_new_tab(url)Any ideas, how to block the url via the script ? or any other suggestions to solve this problem ? Thanks in advance and appreciate your help. |