Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Jan 19, 2020 10:42

In this example we call the Button.Click text command

Sample code:

Capabilities capabilities = driver.getCapabilities();
String executionId = (String) capabilities.getCapability("executionId");
String deviceID = (String) capabilities.getCapability("deviceName");
try {
       URL url = new URL(""+executionId+"?operation=command&securityToken=YourSecurityTokenHere&command=button-text&subcommand=click&param.deviceId="+deviceID+"&param.label=YourLabelHere&param.threshold=80&param.timeout=20");
       HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Accept", "application/json");
if (conn.getResponseCode() != 200) {
       throw new RuntimeException("Failed : HTTP error code : "
                     + conn.getResponseCode());
BufferedReader br = new BufferedReader(new InputStreamReader(
String output;
while ((output = br.readLine()) != null) {
} catch (MalformedURLException e) {
} catch (IOException e) {

For more information on the button click text command see the following article: Button.Click text

Important note: In the above example you would need to replace in the URL your Perfecto lab name, security token and other parameters like label, threshold, etc.