Enabe/Disable javascript in Chrome using selenium in C#

Viewed 1115

I want to disable and enable JavaScript using selenium in C#. I am using Chrome driver. I have searched a lot but I could not find anything. Most of the codes are for Firefox or By another programming language like python. But I could not find anything for Chrome in C#.

1 Answers

You can enable/disable javascript by adding an argument to your options. It will look like this:

     ChromeOptions options = new ChromeOptions();         
     options.AddArgument("--enable-javascript");
Related