'Give head to an already headless Selenium Firefox/Chrome session

I am writing a test bot for an app. Generally I need it to be in headless mode. But at some arbitrary buggy occasions it is a comfort to see the browser window and decide if what a wrong issue is happening there. So I need a way to connect a browser window to an active headless session. In an other word to literally convert it to a head-full one.

P.S. Every thing is in Python. Both Firefox and Chrome solutions(or any sort of guiding) are welcomed.



Solution 1:[1]

You can see the documentation of requests here :

https://docs.python-requests.org/en/latest/

And the documentation for Authentication:

https://docs.python-requests.org/en/latest/user/authentication/

In the example:

>>>from requests.auth import HTTPBasicAuth
>>>requests.get('https://api.github.com/user', auth=HTTPBasicAuth('user', 'pass'))
<Response [200]>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 év3v