GetScreenshot() public method

Gets a Screenshot object representing the image of the page on the screen.
public GetScreenshot ( ) : Screenshot
return Screenshot
コード例 #1
0
        static void Main(string[] args)
        {
            NavigationData data = new NavigationData();

            MenuFilterSection menu = MenuFilterSection.GetConfig();
            List<string> ids = menu.GetItemsToBeRemove();

            string filter = string.Join(",", ids.ToArray());
            MenuOrderSection menuOrder = MenuOrderSection.GetConfig();
            List<SAMenuItemDTO> menuItems = data.GetAllUsedDiagrams(filter);

            List<string> errorUrls = new List<string>();

            foreach (var item in menuItems)
            {
                foreach (var item2 in item.ChildItems)
                {
                    InternetExplorerDriver driver = new InternetExplorerDriver();

                    string url = string.Format("http://wpsa1/tobe_ea/Default.aspx?id={0}", item2.Key);
                    driver.Url = url;

                    var sc = driver.GetScreenshot();

                    sc.SaveAsFile(item2.Key.ToString() + ".jpg", ImageFormat.Jpeg);
                    //Thread.Sleep(100000);

                    var x = driver.FindElementById("reportId");
                    if (x == null)
                    {
                        errorUrls.Add(url);
                    }
                    driver.Quit();
                }
            }

            File.WriteAllLines(@"BrokenPages.txt", errorUrls.ToArray());

            Console.ReadLine();
        }