Company
Date Published
Author
Alex Entrekin
Word count
538
Language
English
Hacker News points
None

Summary

There are several ways to get HTTP status codes in Selenium, including using proxies and headless browsers, or leveraging WebDriver's built-in support for certain tools like Fiddler and BrowserMob. Alternatively, you can use a common hack within WebDriver to grab the error code displayed by the actual browser. The choice of method depends on your specific testing needs and existing setup. Parsing response data from the page is a simple way to extend Selenium without setting up new test frameworks or proxies. However, it may miss certain errors, such as 3xx redirects. Using GhostDriver with PhantomJS can handle status code returns and keep everything in CI, but you may already have testing proxies set up that offer more features. Ultimately, the best approach depends on your specific situation and priorities.