Amol Dongare
Amol Dongare

Reputation: 23

How to disable developer tools in webpage opened by selenium driver?

I have created an application in selenium wherein it opens IE browser and enters user id and password by usind selenium's IE driver. However I want to prevent user from inspecting the auto data filled by selenium in the form. User can easily inspect the data using developer tools. So I want to know the way to disable developer tools options in selenium opened webpages.

Your help is highly appreciable.

Thanks.

Upvotes: 0

Views: 1929

Answers (1)

mutt
mutt

Reputation: 793

Instantiate an instance of OpenQA.Selenium.Interactions.Actions then perform keystrokes for the F12 control. This should toggle on/off the developer tools in Chrome, IE, and Firefox.

I would also include a check to see if one of the controls from the devtools is there before toggling this, just to be sure that you don't turn them on instead of off.

c#:

    OpenQA.Selenium.Interactions.Actions actions = new OpenQA.Selenium.Interactions.Actions([Instance of IWebDriver goes here]);
    actions.SendKeys(OpenQA.Selenium.Keys.F12).Perform();

Upvotes: 1

Related Questions