FIX FOR: Invalid Status code=403 text=Forbidden in Selenium ChromeDriver

FIX FOR: Invalid Status code=403 text=Forbidden in Selenium ChromeDriver


FIX FOR: Invalid Status code=403 text=Forbidden in Selenium ChromeDriver

After 110 version of ChromeDriver, there is an error:
java.io.IOException: Invalid Status code=403 text=Forbidden
This could be fixed by inserting these Chrome Options:

ChromeOptions options = new ChromeOptions();
options.addArguments(“—remote-allow-origins=*”);

Let me know in the comments if this helped!


Content

0.78 -> hi welcome to The Testers Family Channel and today  we will look at the problem why our browser driver  
8.7 -> won't start and what is happening after the new  upgrade to Chrome browser and to Chrome driver  
18.3 -> started popping up after the version 110  
22.56 -> so if I go and open my Chrome driver and  see at the version my current version is  
32.76 -> 111 and after 110 version I'm no longer able to  use Chrome driver as I used to use it before so  
41.1 -> let's take a look what is happening if I go  to my IntelliJ this is my regular settings  
46.14 -> we provide a pass we declare a driver and  we try to open a window so what is going on
58.86 -> window is opened but URL is not posted and there's  no actions done and we are getting an error  
69.84 -> invalid status code text forbidden how  do we fix it for this we need to create  
77.4 -> additional two lines of code I'll type it  in between here and you can type together  
82.68 -> with me and this will fix our issue  so just type with me Chrome options
91.74 -> new Chrome options
94.86 -> the column right now we need to add an  argument to this option and you type remote
104.88 -> allow Origins make sure it's  multiple and then equal asterisks  
114.3 -> so this is your option which will get you  to bypass those security issues that the  
121.5 -> new driver is not able to get in all right  and next you just leave everything as is but  
129.06 -> only you need to pass those options now in your  driver initialization so we put options inside  
136.38 -> here so basically what you added you added  two additional lines of code and options  
143.46 -> to your driver the rest should be still the  same and let's try to execute our test again
155.1 -> and right now it's starting the URL and you can  continue working on your automation test cases  
161.88 -> follow us for more videos like this  we record Solutions we record lessons  
167.46 -> and we just talk a lot about testing  and automation thank you for watching

Source: https://www.youtube.com/watch?v=lcc9ihfNyWc