send command to browser


Send JSON string request to Google Chrome’s Device Mode in order to invoke a new mobile browser emulator, or change environment for a given mobile browser emulator to customize its behaviors during the test run.


Valid contexts

This action may be used within the following project items: test modules and user-defined actions.

Applicable Systems/Platforms

Use of this action is supported on the following systems/platforms:Chrome DevTools’s Device Mode on Windows.

Applicable Built-In Settings

The following setting is applicable to this action: window wait.



Assume that you have set up a Chrome Device Mode mobile device emulator by means of writing a defined JSON profile to the action send command to browser.

During the test run, you’d like to customize certain aspects of the emulator’s environment. You accomplish this with the send command to browser action, sending the appropriate JSON strings through its command argument. The features to be changed (and their corresponding JSON command strings) are:

Action Lines

//Launch Google Chrome   
                            setting                    value
setting                     use browser                Chrome

//Navigate to a URL in Chrome


//Invoke a specified emulator in Chrome's Device Mode

                            window                    command                                                                                                                                                                                                           variable             
send command to browser     google                    [{"method":"Network.setUserAgentOverride","params":{"userAgent":"Mozilla/5.0 (Linux; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.114 Mobile Safari/537.36"}},    >>emulator

//Refresh the page to ensure the emulator takes effect

refresh                     google

//Develop web automation here

//Change environment to customize emulator behaviors on-the-fly
                            window                    command                                                                                                                                                                                                          variable
send command to browser     google                    [{"method":"Network.setUserAgentOverride","params":{"userAgent":"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.23 Mobile Safari/537.36"}},     >>new_behavior
                                                      {"method":"Network.emulateNetworkConditions","params":{  `"offline":false,"latency":100,"downloadThroughput":750,"uploadThroughput":250`}},
                                                      {"method":"Emulation.setGeolocationOverride","params":{  `"latitude":16,"longitude":108,"accuracy":1`}},
                                                      {"method":"DeviceOrientation.setDeviceOrientationOverride","params":{  `"alpha":32,"beta":26,"gamma":7`}}]

//Refresh the page to ensure all new behaviors take effect

refresh                     google

Copyright © 2023 LogiGear Corporation. All rights reserved. LogiGear is a registered trademark, and Action Based Testing and TestArchitect are trademarks of LogiGear Corporation. All other trademarks contained herein are the property of their respective owners.

LogiGear Corporation

1730 S. Amphlett Blvd. Suite 200, San Mateo, CA 94402

Tel: +1(800) 322-0333