How can we disable web security of chrome browser using selenium/TestNg

SHARAN

I want to use the following command using selenium/testng inside my code since every-time I execute the code, a new instance of browser is created by webdriver in which security is enabled by default.

chrome.exe --disable-web-security
Shubham Jain

Try something this, Change the path and slashing accoding to your specifications :-

            WebDriver driver=null;
            System.setProperty("webdriver.chrome.driver","./src//lib//chromedriver");
            DesiredCapabilities capabilities = DesiredCapabilities.chrome();
            ChromeOptions options = new ChromeOptions();
            options.addArguments("test-type");
            options.addArgument("--start-maximized");
            options.addArguments("--disable-web-security");
            options.addArguments("--allow-running-insecure-content");
            capabilities.setCapability("chrome.binary","./src//lib//chromedriver");
            capabilities.setCapability(ChromeOptions.CAPABILITY, options);
            driver = new ChromeDriver(capabilities);
            driver.get("https://www.google.com/");

Below is the link where all available chrome flags are listed :-

http://peter.sh/experiments/chromium-command-line-switches/

Hope it will help you :)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to disable web application in chrome browser

From Dev

How does CORS plugin / --disable-web-security work on browser?

From Dev

Disable Chrome Web Security On Chromebook

From Dev

Chrome extensions disable web security

From Dev

How can I disable flick behavior in a browser? (Chrome/Firefox)

From Dev

How can we use AWS Kinesis in a web browser?

From Dev

How can we render mathjax equation in web browser control?

From Dev

How to disable browser cache in Chrome

From Dev

How can i disable a html control in the web-browser

From Dev

protractor - launch chrome with to disable web security for cors

From Java

Disable-web-security in Chrome 48+

From Dev

Chrome 49 plus --disable-web-security

From Dev

How Can we Retain old session of browser using FirefoxProfile?

From Dev

Can we change the web URL of Android app which is show in URL box when we search app using web browser

From Dev

How to disable google chrome cross domain security

From Dev

How to disable notification popup in Chrome Browser

From Dev

How can we find count of element using selenium web driver

From Dev

How to disable "This file can harm your computer" chrome browser message while downloading a JAR file?

From Dev

Creating Google Chrome shortcut with --disable-web-security

From Dev

SignalR 2.0 CORS Chrome Disable Web Security Strange Behavior

From Dev

Chrome disable web security same origin policy no more working

From Dev

How can I open a website in my web browser using Python?

From Dev

I can't launch Chromium without --disable-web-security, how to fix?

From Dev

Can I disable Chrome browser's Guest Mode?

From Dev

How to disable the back button in the browser using JavaScript

From Dev

How to disable 'Paste' in Android browser using JQuery?

From Dev

How to correct the font of a web page in chrome browser?

From Dev

How can I remove the "Awards Cup" from superuser/stackexchange at the web browser level eg Chrome?

From Dev

How do I disable the warning Chrome gives if a security certificate is not trusted?

Related Related

  1. 1

    How to disable web application in chrome browser

  2. 2

    How does CORS plugin / --disable-web-security work on browser?

  3. 3

    Disable Chrome Web Security On Chromebook

  4. 4

    Chrome extensions disable web security

  5. 5

    How can I disable flick behavior in a browser? (Chrome/Firefox)

  6. 6

    How can we use AWS Kinesis in a web browser?

  7. 7

    How can we render mathjax equation in web browser control?

  8. 8

    How to disable browser cache in Chrome

  9. 9

    How can i disable a html control in the web-browser

  10. 10

    protractor - launch chrome with to disable web security for cors

  11. 11

    Disable-web-security in Chrome 48+

  12. 12

    Chrome 49 plus --disable-web-security

  13. 13

    How Can we Retain old session of browser using FirefoxProfile?

  14. 14

    Can we change the web URL of Android app which is show in URL box when we search app using web browser

  15. 15

    How to disable google chrome cross domain security

  16. 16

    How to disable notification popup in Chrome Browser

  17. 17

    How can we find count of element using selenium web driver

  18. 18

    How to disable "This file can harm your computer" chrome browser message while downloading a JAR file?

  19. 19

    Creating Google Chrome shortcut with --disable-web-security

  20. 20

    SignalR 2.0 CORS Chrome Disable Web Security Strange Behavior

  21. 21

    Chrome disable web security same origin policy no more working

  22. 22

    How can I open a website in my web browser using Python?

  23. 23

    I can't launch Chromium without --disable-web-security, how to fix?

  24. 24

    Can I disable Chrome browser's Guest Mode?

  25. 25

    How to disable the back button in the browser using JavaScript

  26. 26

    How to disable 'Paste' in Android browser using JQuery?

  27. 27

    How to correct the font of a web page in chrome browser?

  28. 28

    How can I remove the "Awards Cup" from superuser/stackexchange at the web browser level eg Chrome?

  29. 29

    How do I disable the warning Chrome gives if a security certificate is not trusted?

HotTag

Archive