how to disable cookies using webdriver for Chrome and FireFox JAVA

前端 未结 6 1927
独厮守ぢ
独厮守ぢ 2020-12-01 16:55

I want launch browsers(FF, CHROME) for test with disabled cookies, I tried this:

           service =
                    new ChromeDriverService.Builder()
          


        
6条回答
  •  悲哀的现实
    2020-12-01 17:08

    For IE following works-

    to disable cookie:

    String command = "REG ADD \"HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\ \" /v       1A10 /t REG_DWORD /d 0X3 /f";  
    Runtime.getRuntime().exec(command);  
    

    to enable cookie:

    String command = "REG ADD \"HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\ \" /v       1A10 /t REG_DWORD /d 0X1 /f";
    Runtime.getRuntime().exec(command); 
    

提交回复
热议问题