Member-only story
Quick Web Test Automation Tip: Inspect Page With Right-Click Disabled
How to get around sites with right-click disabled to get element details.
Non-Medium Members: You can read this article for free on Substack.
As part of automated scripting, being able to identify elements is critical to finding locators. A common way to do this is by right-clicking the element and inspecting it. However, some websites block right-click intentionally!
Find a web page where right-mouse click is disabled. I will use the web version of Instagram. While right-click is enabled for most of the webpage, it is disabled for someone’s profile picture.
This article shows several ways to enable the right-click, including with browser extensions.
In-Built Browser Inspector
Your browser comes with it’s own element inspector, you can use this to override and select the specific ‘unclickable’ element.
In Chrome, press the F12 key (or Command + Option + I) to open the browser inspector pane (in Firefox, the shortcut is Command + Option + C). Then, go to the Elements panel and select the “Select Element” mode (Command + Shift + C for Chrome and Firefox).