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

Last updated: Sep 16, 2019 17:01

Problem

Scanning QR code using image injection fails, possibly because the injection process cannot locate the image frame. This may happen when the image is too large.

Solution

Make sure the QR code shows blank space around the image. This spacing allows the injection process to locate the image frame and scan the code. This is similar to preparing a check for use with image injection, as detailed in Creating images to be used with check scanning apps.

To create spacing, you can adjust the image. Adjusting an image is the equivalent of zooming out or shrinking the image. The adjustment parameter takes on a value between 1 and 200.

The following sample code shows how to use the adjustment parameter in your script:

Map<String, Object> params = new HashMap<>();
params.put("repositoryFile", "PRIVATE:cc_640.jpg");
params.put("identifier", "Victor.RealTimeFilter");
params.put("adjustment", "80");
params.put("resize", "true");
Object res = driver.executeScript("mobile:image.injection:start", params);

Alternatively, you can set the adjustment parameter for your script in the Automation UI, as follows:

  1. In the Automation view, on the Functions tab, go to Device > Image Injection and double-click the Start image injection function to add it to your script.
  2. In the script pane, double-click the function. 
  3. In the dialog box that opens, on the Parameters tab, select Show Advanced Parameters.
  4. To the right of the Adjustment parameter, select the checkbox to enable the parameter. Then enter a number in the Value column.
  5. Click OK.