Add padding to screenshot

I’m using storeImage at the moment. While it’s working properly, there are some part of the screenshots truncated that is why I need to add padding before taking a screenshot.

Anyone who might help me on this?
Thank you!

Do you have an example of such a truncated storeImage? Best would be a tiny test macro.

Hi ulrich.

Imagine that the xpath below is rectangle (see red rectangle below)…

{
  "Command": "storeImage",
  "Target": "xpath=//div/abcd12313",
  "Value": "${filename}"
}

The command above captures that DOM (red) rectangle object but what I really want to do is to add padding to it – the purple rectangle.

Since there are “texts” not captured by the xpath, i need to add padding to it.

image

Any inputs on how I should handle this are appreciated.

I see two options:

  1. Select a different Xpath. The “Select” button from UIvision can help with this!
  2. Or: Get the XPath parent node from child node. So if your normal XPath selector is
  • xpath=//*[@id="something"]/div[2]

…to select the parent node add /parent::* or or /.. :

  • xpath=//*[@id="something"]/div[2]/parent::*
  • xpath=//*[@id="something"]/div[2]/span/..

Demo macro result (see below):
Image a1 is:

a1

Image a2/a3 are:

Parent node macro:

{
  "Name": "parentxpath",
  "CreationDate": "2020-5-8",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://ui.vision/rpa",
      "Value": ""
    },
    {
      "Command": "storeImage",
      "Target": "xpath=//*[@id=\"content download-content\"]/div[2]/div[2]/p/span",
      "Value": "a1"
    },
    {
      "Command": "comment",
      "Target": "Two XPath ways to get the parent node (both have the same result)",
      "Value": "a2"
    },
    {
      "Command": "storeImage",
      "Target": "xpath=//*[@id=\"content download-content\"]/div[2]/div[2]/p/span/parent::*",
      "Value": "a2"
    },
    {
      "Command": "storeImage",
      "Target": "xpath=//*[@id=\"content download-content\"]/div[2]/div[2]/p/span/..",
      "Value": "a3"
    }
  ]
}