One big question I’ve been asked a few days ago. it is possible to automate Google Earth with QuickTest?
the answer is yes!
to do that you need some follow some pre-requisites.
- Web + ActiveX add-ins must be loaded.
- Google heart plug-in must be installed as an add-on on your browser http://code.google.com/apis/earth/.
- Familiarize with Google Earth API .
This demo works only on browser embedded Google Earth maps. The demo will change view types, display controls on the window and “DIVE” into Times Square, New York
the demo was tested on Internet Explorer 7.
Const URL = "http://earth-api-samples.googlecode.com/svn/trunk/demos/kmlplayground/index.html"
Const SW_MAXIMIZED = 3
' Closing any open browsers and reopen URL
SystemUtil.CloseProcessByName "iexplore.exe"
SystemUtil.Run "iexplore.exe", URL, "", "open", SW_MAXIMIZED
Browser("CreationTime:=0").Page("index:=0").Sync
Set objActiveX = Browser("CreationTime:=0").Page("index:=0").ActiveX("progid:=GEPluginCoClass.GEPluginCoClass.1.0", "location:=0").Object
' setting variables values
ALTITUDE_ABSOLUTE = objActiveX.ALTITUDE_ABSOLUTE
VISIBILITY_SHOW = objActiveX.VISIBILITY_SHOW
ALTITUDE_RELATIVE_TO_GROUND = objActiveX.ALTITUDE_RELATIVE_TO_GROUND
MAP_TYPE_EARTH = objActiveX.MAP_TYPE_EARTH
MAP_TYPE_SKY = objActiveX.MAP_TYPE_SKY
SPEED_TELEPORT = objActiveX.SPEED_TELEPORT
wait 2
' Changing to SKY view
Set geOptions = objActiveX.getOptions()
Call geOptions.setMapType( MAP_TYPE_SKY )
wait 5
' Changing to EARTH view
Call geOptions.setMapType( MAP_TYPE_EARTH )
' Setting to Minimum zoom at max speed
geOptions.setFlyToSpeed( SPEED_TELEPORT )
Set kmlLookAt = objActiveX.getView().copyAsLookAt( ALTITUDE_ABSOLUTE )
kmlLookAt.setRange(50000000)
objActiveX.getView().setAbstractView(kmlLookAt)
wait 2
' adding visual controls
geOptions.setGridVisibility( true )
geOptions.setStatusBarVisibility(true)
geOptions.setScaleLegendVisibility( true )
geOptions.setMouseNavigationEnabled( true )
geOptions.setOverviewMapVisibility( true )
' retrieve the navigating control
Set geNavigationControl = objActiveX.getNavigationControl()
geNavigationControl.setVisibility( VISIBILITY_SHOW )
Set geView = objActiveX.getView()
Set kmlLookAt = geView.copyAsLookAt( ALTITUDE_RELATIVE_TO_GROUND )
' ** MAIN DEMO : set speed, tilt and heading
geOptions.setFlyToSpeed(0.5)
kmlLookAt.setTilt(0)
kmlLookAt.setHeading(0)
' Times Square, New York, NY
kmlLookAt.setLatitude( 40.7594 )
kmlLookAt.setLongitude( -73.985 )
' setting new values
objActiveX.getView().setAbstractView(kmlLookAt)
'zooming…
For i = 1 to 17
kmlLookAt.setRange(kmlLookAt.getRange() * 0.5)
objActiveX.getView().setAbstractView(kmlLookAt)
Wait 1
Next
Posted in web


daniva




December 15th, 2009 at 11:57 am
[…] Automating Google Earth | AdvancedQTP http://www.advancedqtp.com/knowledge-base/articles/environment-techniques-id15/ – view page – cached One big question I’ve been asked a few days ago. it is possible to automate Google Earth with QuickTest? the answer is yes! to do that you need some follow […]
December 16th, 2009 at 7:01 am
This is a good post on automating Goog Earth, but it has nothing to do with QTP though :) except for one line where you get reference to the browser.
I would suggest to remove the word QTP from the title, it don’s deserve credit for this
December 17th, 2009 at 5:59 am
hi mailkharti
maybe you have never need to test maps.
what i did is only an example, and share and a knowledge to accessing maps for who ever need that.
i demonstrated that this task can be done with QTP.
December 21st, 2009 at 11:31 am
this is very good!
January 6th, 2010 at 9:27 pm
excellent as usual !
February 24th, 2010 at 8:23 am
Its a nice thought
April 26th, 2010 at 9:10 pm
Hello,
I am Pretty new and I have this Web Application which has google maps embedded in it.In automation i need to automate a step where i zoom in to a location and select an area with mines.while recording zoom in and selection dont work on map.Can you please help?