You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On this webpage: https://www.selenium.dev/downloads/ I am trying to capture the screenshot of an element that is an img tag.
You can inspect : img[alt='Java']
This is the img element I want to capture.:
So to capture the above element I wrote this code:
But when I opened the image, it is just all white:
And if I remove the shooting shotingStrategy and just use new AShot().takeScreenshot(driver,imgJava);
It will take screenshot of whole page even though I passed a particular element:
The text was updated successfully, but these errors were encountered:
I solved this problem. This is because of Scale settings in Windows.
You should open Display settings -> Scale and layout -> reset to 100% .
Let me know if these steps have helped you :)
You can also multiply the coordinate values by the percentage of monitor scaling.
For example: if the scale is 175%, then @param monitorScale = 1.75 .getSubimage((int) (point.getX()*monitorScale ), (int) (point.getY()*monitorScale ), (int) (elemWidth*monitorScale ), (int) (elemHeight*monitorScale ))
On this webpage: https://www.selenium.dev/downloads/ I am trying to capture the screenshot of an element that is an img tag.
You can inspect :
img[alt='Java']
This is the img element I want to capture.:
So to capture the above element I wrote this code:
But when I opened the image, it is just all white:
And if I remove the shooting
shotingStrategy
and just usenew AShot().takeScreenshot(driver,imgJava);
It will take screenshot of whole page even though I passed a particular element:
The text was updated successfully, but these errors were encountered: