Controlling the TOR browser launch process with Python
I would like to control the launch process of the TOR browser in the following way: Have the TOR browser start, build a circuit, gauge the average bandwidth, and build a new circuit if a certain bandwidth threshold isn’t reached.
Something along the lines of (pseudocode):
i==0; WHILE i < 10: START tor_browser DOWNLOAD https://blah.com/test.png bw = DOWNLOAD.bandwidth() IF bw > bw_min: #e.g. 2 Mbps BREAK ELSE: QUIT tor_browser i++1 END
Does the TOR browser have an API that can interface e.g. with Python? If not, would it be possible to "address" certain Linux GUI elements (such as the address bar of a browser window or the "Load Page" button) via Python, e.g. write a script that starts the TOR browser, clicks on the address bar, enter a URL, and loads a page while monitoring traffic through TCP port 9150?