I have a few tests in my suite, and the only way I can really verify that something is occuring the way it is supposed to, is by saving a screenshot of that specific element area and comparing it to another file.
I have custom implemented code that handles the actual comparison itself exactly how I want to.
The thing I'm having the most issue with is trying to figure out the best way to take a screenshot of the element I'm comparing. It is a div with a bunch of img's inside of it.
I basically want to be able to screenshot the div, with all of the img's inside it, and compare that screenshot to a predetermined image.
Any help pointing me in the right direction would be appreciated.
5 Answers, 1 is accepted
I guess I should point out that I have tried using the GetRectangle() method on the highest level DIV that contains the elements that I want, and then using that Rectangle() to save an image.
This worked at first, however at some point it started saving images that were not what was currently on the screen (it was saving previously displayed stuff). I tried fixing this by updating the DOM in code before getting the Rectangle, but this didn't seem to help at all.
Thank you for contacting us sharing that much details.
In a coded step you do not need to use GetRectangle(). Instead you could apply the following row of code against any of the already existing elements in the Elements repository:
Pages.Google.BtnKSubmit.Capture(@
"C:\", "
NewFile");
where you put the folder location and the file name as parameters. This will get a *.bmp image of the element in question to compare it with the custom code you have.
Regards,
Elena Tsvetkova
Telerik by Progress
I have used the following steps, but every time i am getting the pop-up with "Ok" button. if i click on the ok button only am getting the screen shot.
If i am have 11 steps.. if i used the below code for 2 steps.. than the remaining steps are not executing.
//Log.CaptureBrowser(ActiveBrowser, "Dashboard");
Other one:
//ITakeScreenshot ActiveBrowser = null;
//Screenshot SS = ((ITakeScreenshot)ActiveBrowser).GetScreenshot();
//SS.Savefile("D:\\Telerik_Test_Studio\\Hudson\\Dashboard.png", System.Drawing.Imaging.ImageFormat.Png);
I have used the following steps, but every time i am getting the pop-up with "Ok" button. if i click on the ok button only am getting the screen shot.
If i am have 11 steps.. if i used the below code for 2 steps.. than the remaining steps are not executing.
//Log.CaptureBrowser(ActiveBrowser, "Dashboard");
Other one:
//ITakeScreenshot ActiveBrowser = null;
//Screenshot SS = ((ITakeScreenshot)ActiveBrowser).GetScreenshot();
//SS.Savefile("D:\\Telerik_Test_Studio\\Hudson\\Dashboard.png", System.Drawing.Imaging.ImageFormat.Png);
You have submitted your query into another public forum item - to avoid any duplication in the discussion, I suggest we keep the conversation in the other ongoing thread here.
Thank you for your understanding in advance.
Regards,
Elena Tsvetkova
Progress Telerik