Python Forum
Request blocking in Chrome Incognito mode
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Request blocking in Chrome Incognito mode
#1
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] Why is this asyncio task blocking? SecureCoop 1 783 Jun-06-2023, 02:43 PM
Last Post: SecureCoop
  Non-blocking real-time plotting slow_rider 5 3,639 Jan-07-2023, 09:47 PM
Last Post: woooee
  Make code non-blocking? Extra 0 1,138 Dec-03-2022, 10:07 PM
Last Post: Extra
Question Selenium with proxy authenticated and incognito keahi32 0 957 Apr-19-2022, 09:52 PM
Last Post: keahi32
  how can I correct the Bad Request error on my curl request tomtom 8 5,085 Oct-03-2021, 06:32 AM
Last Post: tomtom
  Need to run 100+ Chrome’s with Selenium but can’t get past ~15 without breaking imillz 0 1,367 Sep-04-2021, 04:51 PM
Last Post: imillz
  things that work in terminal mode but not in sublime mode alok 4 2,893 Aug-11-2021, 07:02 PM
Last Post: snippsat
  Selenium Chrome error Leo_Red 2 1,874 Nov-05-2020, 02:40 PM
Last Post: Leo_Red
  ImportError: cannot import name 'Request' from 'request' abhishek81py 1 3,938 Jun-18-2020, 08:07 AM
Last Post: buran
  How to make chrome extension in python? Hassibayub 1 2,733 May-06-2020, 04:17 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020