How to get status code by using selenium.py (python code)

前端 未结 12 1115
深忆病人
深忆病人 2020-11-30 01:01

I am writing a selenium script by python, but I think I don\'t see any information about:

How to get http status code from selenium Python code.

12条回答
  •  我在风中等你
    2020-11-30 01:36

    I'm using java here as I haven't got much experience in Python. Also, I don't know how to get only the http status codes. Following will give you the entire network traffic, you can capture status codes from it.

    First start your server as

    selenium.start("captureNetworkTraffic=true");
    

    Then capture your trafic as

    String traffic = selenium.captureNetworkTraffic("xml");
    

    You can get output in json as well.

提交回复
热议问题