Search code examples
pythonseleniumwebdriverhttprequestopera

Selenium Python get data from HTTP request


I am running automation with Selenium and Python on Opera web driver, when I enter the specific page that I need, a request is sent to the server, it is authenticated with anti-content which blocks me from requesting it, then the only solution is to get the returned JSON after sending the request, I had checked selenium-wire, but I think it doesn't fit my needs, I thought if there is another way to do that, any suggestions?


Solution

  • You can try to use Titanium Web Proxy. It is a proxy server and can be installed via Nuget package and used with Selenium.

    string body = await e.GetResponseBodyAsString();
    

    Reference:
    https://github.com/justcoding121/Titanium-Web-Proxy/issues/176
    https://www.automatetheplanet.com/webdriver-capture-modify-http-traffic/#tab-con-9