Currently I trying to capture a screenshot using the Selenium WebDriver but most far as i can go is just the whole page screen shot. However, what I wanted is just to capture a part of the page or perhaps just on specific element based on id. Any way to capture a screenshot by selected item or element?
For example, i wish to capture the picture with image id = "Butterfly" only... Is it possible to do that? Thank in advance.
IWebElement img = driver.FindElement(By.Id("IMG1"));
int width = img.Size.Width;
int height = img.Size.Height;
Point point = img.Location;
int x = point.Location.X;;
int y = point.Location.Y;
RectangleF part = new RectangleF(x, y, width, height);
Bitmap bmpobj = new Bitmap(filePath);
Bitmap bn = bmpobj.Clone(part, bmpobj.PixelFormat);
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/1274960a-6967-4282-8280-1eb567b70362%40googlegroups.com.