py4cytoscape.tools.cybrowser_send
-
cybrowser_send
(id=None, script='', base_url='http://127.0.0.1:1234/v1')[source] Cybrowser Send.
Send the text to the browser indicated by the id and return the response, if any. Note that the JSON result field could either be a bare string or JSON formatted text.
- Parameters
id (str) – The identifier for the new browser window
script (str) – Note that only string results are returned.
base_url (str) – Ignore unless you need to specify a custom domain, port or version to connect to the CyREST API. Default is http://127.0.0.1:1234 and the latest version of the CyREST API supported by this version of py4cytoscape.
- Returns
{‘browserId’: id, ‘result’: result}
- Return type
dict
- Raises
CyError – if the browser could not execute the command
requests.exceptions.RequestException – if can’t connect to Cytoscape or Cytoscape returns an error
Examples
>>> cybrowser_send(id='Test Window', script='navigator.userAgent') {'browserId': 'Test Window', 'result': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/608.1 (KHTML, like Gecko) JavaFX/13 Safari/608.1 CyBrowser/1.2.0'} >>> cybrowser_send(id='CytoWindow', script="window.location='http://google.com'") {'browserId': 'CytoWindow', 'result': 'http://google.com'}
Note
In the return result,
id
is the one provided as a parameter to this function andresult
is the string returned as a result of executing the scriptSee also