How to identify an http (500) error via selenium web driver or javascript

1

I need to mount a script that will scan certain pages and find http errors, specific to 500. I thought about doing a selenium script, but I do not know a command that I can "read" this type of error. Can anyone tell me if selenium has any commands for this, or javascript?

    
asked by anonymous 10.09.2016 / 05:03

1 answer

1
  

Can anyone tell me if selenium has any commands for this, or javascript?

Selenium itself, no. What you can do is trigger a request using a shared session and collect the error status.

The package I know you do is selenium-requests . An example:

from seleniumrequests import *

browser = Firefox();
# Faça algumas ações aqui, como autenticar login, se for o caso.
retorno_requisicao = browser.request('GET', "http://sitequalquer.com")
if retorno_requisicao.status_code >= 500:
    # Trate os erros aqui.
    
10.09.2016 / 05:50