|
Example Program #02
This is a lengthier C++ program that illustrates
simple navigation as well as retrieval of the specific
index within a page.
In addition, the eValid EPI program and the script
also note the elapsed time up to a particular point
in the playback.
Also, during the programmatic playback the program interrogates the
playback log after each command execution.
#include "stdafx.h"
#include "epi.h"
int main ()
{
::CoInitialize( NULL );
IEvalid * pEvalid = NULL;
if( SUCCEEDED( CoCreateInstance( CLSID_Evalid, NULL,
CLSCTX_INPROC_SERVER, IID_IEvalid, ( void** )&pEvalid ) ) )
{
// End of setup section, beginning of programmatic area...
long index = 0;
CComBSTR bstr_Status, bstr_Log;
CComBSTR bstr_Url( _T( "http://www.google.com" ) );
pEvalid->InitLink( bstr_Url );
pEvalid->get_LastPlaybackLog( &bstr_Log );
pEvalid->Wait( 10000 );
pEvalid->get_LastPlaybackLog( &bstr_Log );
pEvalid->GotoLink( 0, CComBSTR( _T( "http://www.amazon.com" ) ),
CComBSTR( _T( "" ) ) );
pEvalid->get_LastPlaybackLog( &bstr_Log );
pEvalid->Wait( 1000 );
pEvalid->get_LastPlaybackLog( &bstr_Log );
pEvalid->Reload( 0 );
pEvalid->get_LastPlaybackLog( &bstr_Log );
pEvalid->IndexSet( 0 );
pEvalid->get_LastPlaybackLog( &bstr_Log );
pEvalid->IndexFindElement( 0, CComBSTR( _T( "DOWN" ) ),
CComBSTR( _T( "innerText" ) ), CComBSTR( _T( "Your Account" ) ),
CComBSTR( _T( "" ) ), &index );
pEvalid->get_LastPlaybackLog( &bstr_Log );
pEvalid->ElapsedTime();
pEvalid->get_LastPlaybackLog( &bstr_Log );
pEvalid->IndexFollowLink( 0, CComBSTR( _T( "" ) ), VARIANT_BOOL("VARIANT_FALSE") );
pEvalid->get_LastPlaybackLog( &bstr_Log );
pEvalid->ExitNow();
pEvalid->get_LastPlaybackLog( &bstr_Log );
pEvalid->get_LastPlaybackStatus( &bstr_Status );
// End of programmatic area, start of teardown section...
pEvalid->Release();
}
::CoUninitialize();
return 0;
}
|
Resources
Corresponding eValid Script
Here is the corresponding eValid recorded script:
# Copyright 2020 by Software Research, Inc. # Recording made on: Microsoft Windows XP Service Pack 2 # Recording started. ProjectID "FunctionalTests" GroupID "Experimental" TestID "example02" LogID "AUTO" ScreenSize 1280 1024 FontSize 0 DeleteCache DeleteCookies InitLink "http://www.google.com/" Wait 10000 GotoLink 0 "http://www.amazon.com/" "" Wait 1000 Reload 0 IndexSet 0 IndexFindElement 0 DOWN "innerText" "Your Account" "" ElapsedTime IndexFollowLink 0 "" ExitNow # Recording stopped. |