using LoginPI.Engine.ScriptBase; using System; public class googleEarthChromeBrowser : ScriptBase { void Execute() { /* -Disclaimer: This workload is provided as-is and might need further configuration and customization to work successfully in each unique environment. For further Professional Services-based customization please consult with the Login VSI Support and Services team. Please refer to the Help Center section "Application Customization" for further self-help information regarding workload crafting and implementation. -YouTube video: https://youtu.be/Gfr41W6K1po -Run the workload against the "target" using Script Editor to ensure it will work before uploading it and testing with it -Workload version and changelist: --V1.1 | Last updated: 26 Apr 2022 | Removed tutorial interaction as it doesn't show by default anymore. Updated some FindControls to FindControlWithXpaths, leaving the original FindControl in-line but commented-out, changed START() function to be ShellExecute() instead to launch Chrome -Leave Application running compatibility: true Notes: -This should be a CPU, memory, and (if applicable) GPU-intensive workload -Please read each of the commented-out portions of this script, to see what it does and if there are lines which should be commented out or changed (variables, for example) -Environment: Win 11 Pro x64 21H2 | Version 100.0.4896.127 (Official Build) (64-bit) | Google Earth Web version 9.159.0.0 | Login Enterprise ScriptingToolset version 4.8.4 This script will: -Open Google Earth in Chrome -Verify Google Earth has loaded -Enable the Photos (overlay) feature -Set the map style to "Everything" ("All borders, labels, places, roads, transit, landmarks and water") -Turn on Animated Clouds graphics -Turn on the Gridlines graphical feature -Look for the "I'm Feeling Lucky" button -Perform the following in a loop (defined amount): click the "I'm Feeling Lucky" button (in order to "fly" to a random location) and wait for a defined amount of time with the camera hovering and flying, encircling the location -Stop the Chrome web browser */ // Set variables double waitHeartbeat = 0.5; // This is how long to sleep the workload execution, in seconds, in between functions int metafunctionGlobalTimeout = 60; // This is how long, in seconds, metafunctions will wait before timing out int howManyImFeelingLuckyInstances = 3; // Define here how many times to click on the "I'm Feeling Lucky" button, which will "fly" to a random location int howLongWaitInSecondsAfterInitialImFeelingLuckyClick = 8; int howLongWaitInSecondsAfter3DMapButtonPressInSeconds = 2; int howLongWaitInSecondsBeforeClickingImfeelingLuckyAgain = 2; string chromeLaunchPath = @"c:\program files (x86)\google\chrome\application\chrome.exe"; // End set variables section // This is the script invocation part -- this will open Google Earth in Chrome; this is encapsulated with a custom timer ShellExecute("taskkill /f /im chrome*",waitForProcessEnd:true,timeout:metafunctionGlobalTimeout); // This is optional to kill existing Chrome processes, as a pre-cleanup Wait(waitHeartbeat); StartTimer(name:"GoogleEarthInterfaceLoadTime"); StartTimer(name:"GoogleEarthWebMapsLoadedTime"); // Time to maps being fully loaded 100%, per interface ShellExecute(chromeLaunchPath + " --force-renderer-accessibility -incognito earth.google.com/web",waitForProcessEnd:false); var MainWindow = FindWindow(className : "Pane:Chrome_WidgetWin_1", title : "Google Earth - Google Chrome", processName : "chrome",timeout:metafunctionGlobalTimeout); // Making sure window loaded MainWindow.FindControlWithXPath(xPath : "Document:Chrome_RenderWidgetHostHWND/ToolBar/Button",timeout:metafunctionGlobalTimeout); // Looking for earth Menu button // var skipIntroButton = MainWindow.FindControlWithXPath(xPath : "Document:Chrome_RenderWidgetHostHWND/Pane/Document/Button",timeout:metafunctionGlobalTimeout); // This will find the Skip (intro tutorial) button // Commenting this out because the tutorial isn't the landing page anymore StopTimer("GoogleEarthInterfaceLoadTime"); MainWindow.FindControl(className : "Text", title : "100%",timeout:metafunctionGlobalTimeout); StopTimer(name:"GoogleEarthWebMapsLoadedTime"); MainWindow.Focus(); Wait(waitHeartbeat); // This will get past the tutorial // Commenting this out because the tutorial isn't the landing page anymore // MainWindow.FindControl(className : "Button", title : "SKIP",timeout:metafunctionGlobalTimeout).Click(); // This will click the Skip (intro tutorial) button //StartTimer(name:"TimeToSearchButtonVisible"); // This will look for the search button. This should indicate Google Earth has been loaded //StopTimer(name:"TimeToSearchButtonVisible"); //Wait(waitHeartbeat); // This will enable the Photos feature var earthMenuButton = MainWindow.FindControlWithXPath(xPath : "Document:Chrome_RenderWidgetHostHWND/ToolBar/Button",timeout:metafunctionGlobalTimeout); // MainWindow.FindControl(className : "Button", title : "Menu",timeout:metafunctionGlobalTimeout); // Wait for earth to load before interacting with it earthMenuButton.Click(); Wait(waitHeartbeat); var photosButton = MainWindow.FindControlWithXPath(xPath : "Document:Chrome_RenderWidgetHostHWND/Group[1]/Menu/MenuItem[4]/Button",timeout:metafunctionGlobalTimeout); // MainWindow.FindControl(className : "Button", title : "Photos",timeout:metafunctionGlobalTimeout); photosButton.Click(); Wait(waitHeartbeat); // The following will set the map style to "Everything" earthMenuButton.Click(); Wait(waitHeartbeat); var mapStyleButton = MainWindow.FindControlWithXPath(xPath : "Document:Chrome_RenderWidgetHostHWND/Group[1]/Menu/MenuItem[3]",timeout:metafunctionGlobalTimeout); // MainWindow.FindControl(className : "Button", title : "Map Style",timeout:metafunctionGlobalTimeout); mapStyleButton.Click(); Wait(waitHeartbeat); var everythingButton = MainWindow.FindControlWithXPath(xPath : "Document:Chrome_RenderWidgetHostHWND/Group/Group/RadioButton[2]",timeout:metafunctionGlobalTimeout); // MainWindow.FindControl(className : "RadioButton", title : "Everything All borders, labels, places, roads, transit, landmarks and water.",timeout:metafunctionGlobalTimeout); everythingButton.Click(); Wait(waitHeartbeat); // This will turn on Animated Clouds graphics (slider button) var turnOnAnimatedCloudsButton = MainWindow.FindControlWithXPath(xPath : "Document:Chrome_RenderWidgetHostHWND/List/ListItem[1]/Button[1]",timeout:metafunctionGlobalTimeout); // MainWindow.FindControl(className : "Button", title : "Turn on Animated Clouds",timeout:metafunctionGlobalTimeout); turnOnAnimatedCloudsButton.Click(); Wait(waitHeartbeat); // This will turn on the Gridlines graphical feature var turnOnGridlinesButton = MainWindow.FindControlWithXPath(xPath : "Document:Chrome_RenderWidgetHostHWND/List/ListItem[2]/Button",timeout:metafunctionGlobalTimeout); // MainWindow.FindControl(className : "Button", title : "Turn on Gridlines",timeout:metafunctionGlobalTimeout); turnOnGridlinesButton.Click(); Wait(waitHeartbeat); var sideBarCollapseButton = MainWindow.FindControlWithXPath(xPath : "Document:Chrome_RenderWidgetHostHWND/Button[1]",timeout:metafunctionGlobalTimeout); Wait(waitHeartbeat); sideBarCollapseButton.Click(); Wait(waitHeartbeat); // This will look for the I'm Feeling Lucky button; it will subsequently click the button in order to "fly" to a random location var imFeelingLuckyButton = MainWindow.FindControlWithXPath(xPath : "Document:Chrome_RenderWidgetHostHWND/ToolBar/Button[3]",timeout:metafunctionGlobalTimeout); // MainWindow.FindControl(className : "Button", title : "I'm Feeling Lucky",timeout:metafunctionGlobalTimeout); int imFeelingLuckyClickCount = 0; while(imFeelingLuckyClickCount < howManyImFeelingLuckyInstances) // This is the I'm Feeling Lucky clicking/interacting loop { Log(imFeelingLuckyClickCount); imFeelingLuckyButton.Click(); Wait(howLongWaitInSecondsAfterInitialImFeelingLuckyClick); // Define, in seconds, how long to wait after the I'm Feeling Lucky button is clicked (the camera will "fly" to the random location in this time) Type("o"); // This will toggle 2d/3d Wait(howLongWaitInSecondsAfter3DMapButtonPressInSeconds); // Define, in seconds, how long to have the 2d/3d toggled on Type("o"); // This will toggle 2d/3d again Wait(howLongWaitInSecondsBeforeClickingImfeelingLuckyAgain); // Define, in seconds, how long to wait before clicking the I'm Feeling Lucky button again imFeelingLuckyClickCount++; } // This will stop the Chrome app and the script STOP(); ShellExecute("taskkill /f /im chrome*",waitForProcessEnd:true,timeout:metafunctionGlobalTimeout); // This is optional to kill lingering Chrome processes, in case } }