Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Don't stop on HTTP error 403

In one of my Selenium test cases, I try to ensure that certain pages can't be accessed. Instead, HTTP return code 403 should be given.

However, here Selenium terminates test execution with the following exception:

com.thoughtworks.selenium.SeleniumException: XHR ERROR: URL = http://user:[email protected]/admin Response_Code = 403 Error_Message = Forbidden

Any way to work around that?

like image 905
Sebi Avatar asked Mar 20 '26 23:03

Sebi


1 Answers

Seems like I have to answer the question myself...

I now surround the "open" call with a try...catch block. There, I parse the exception message if it contains the 403 code and XHR ERROR. Seems to me not very clean, but it works.

like image 177
Sebi Avatar answered Mar 24 '26 23:03

Sebi



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!