I need to save image of an element in predefined dimension

hi
when i use store image for saving an image of element it stored in dimension related to percent zoom of web page
i need to know if we can define dimension of image that saved in hard so dimension of saved image independent od zoom value

Can you simply set the zoom level to 100%?

no because i use my code on several monitors with different resolution that cause to display web elements too big on some so i must set zoom level in some to 80% and some to 67% to perfect web view and so the image that stored by storeimage has different dimention on both above and problem is here
i look after command that ensure the image i saved has pre defined dimension independent of zoom level
tnx

storeImage takes a screenshot of the element, so it saves the image as displayed in the web browser, including zoom level.

To save the original file you can automate the "Save Image As " dialog:

In this example I am saving the “A” image of your avatar :wink:

Macro:

{
  "Name": "saveas",
  "CreationDate": "2020-2-25",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://forum.ui.vision/t/i-need-to-save-image-of-an-element-in-predefined-dimension/4660",
      "Value": ""
    },
    {
      "Command": "XClick",
      "Target": "xpath=//*[@id=\"post_1\"]/div/div[1]/a/img",
      "Value": "#right"
    },
    {
      "Command": "XType",
      "Target": "${KEY_DOWN}${KEY_DOWN}${KEY_DOWN}${KEY_DOWN}${KEY_DOWN}${KEY_DOWN}${KEY_DOWN}",
      "Value": ""
    },
    {
      "Command": "XType",
      "Target": "${KEY_ENTER}",
      "Value": ""
    },
    {
      "Command": "pause",
      "Target": "1000",
      "Value": ""
    },
    {
      "Command": "XType",
      "Target": "${KEY_ENTER}",
      "Value": ""
    }
  ]
}

Hi TechSupport,

that looks great, is it possible to set the name of the file?

Thanks for your help.

Yes tou can set the name, need to set your browser to ask to save and after with Xtype you can type the file name to save.

2 Likes