Skip to content
CheshireCaat edited this page Mar 9, 2020 · 10 revisions

You can send custom messages to your script using BasRemoteClient. It's very useful if you want to perform actions like:

  • Retrieve results/logs.
  • Set/get global variables.
  • Show/hide browsers. and other different actions.

You can send a custom message using the send_async method. This method can be used with the await keyword. In this case, the response will be contained in the variable you specify. You can also send message synchronously using asyncio event loop. If want to do this, you can use the event_loop.run_until_complete() function. You can read more about asyncio here.

Take a look at examples:

Send message and wait for result

# Set global variable with name 'TEST_VARIABLE' and value 'Hello'.
await client.send_async('set_global_variable', {
    'value': json.dumps('Hello'),
    'name': 'TEST_VARIABLE',
})

# Retrieve actual variable value.
actual = await client.send_async('get_global_variable', {
    'name': 'TEST_VARIABLE'
})

# Print the value.
print(actual)
Clone this wiki locally