Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i stop the blocking of redirects in my chromedriver?

I have a scenario that clicks a button that performs a few redirects before landing on the intended page.

The issue is that these redirects get blocked within the Chromedriver session that is opened when the button is clicked.

Is there some sort of setting I can set for the Chromedriver so every time the script is run, the redirects don't get blocked?

Chrome version: 74.0.3729.157

Code tried :

options.addArguments("--disable-popup-blocking");  

This as far as i'm aware will only disable the popup blocking, not redirects? I've also tried within the session manually preventing the blocking of the redirects, but the next time i run the scenario the redirects are blocked again

like image 275
Mr-Ho Avatar asked Oct 25 '25 08:10

Mr-Ho


2 Answers

You can disable Safe Browsing in Chrome Settings:

Settings > Sync and Google services > Other Google services > Safe browsing

Or, try with this option

options.addArguments("--disable-web-security");
like image 106
Mate Mrše Avatar answered Oct 26 '25 22:10

Mate Mrše


Try to add below to the driver, it works for me

ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-web-security");

WebDriver driver = new ChromeDriver(options);
like image 36
meter97 Avatar answered Oct 27 '25 00:10

meter97



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!