ChandanD
5 years agoContributor
Opening a specific path using Test Complete
Hello,
I want to launch C:\XYZ\ using script
I am using below script
// This test case to download SVN folder
function checkoutsvn()
{
var path
try
{
myapp = Aliases.TortoiseProc
path = Project.Path
var TIMEOUT= ProjectSuite.Variables.GetVariableDefaultValue("Timeout")
var driverObject = DDT.ExcelDriver(path + "\\Testdata\\SVN_Testdata.xlsx","download",true)
while(!driverObject.EOF())
{
Sys.Desktop.Keys("[Hold][Win]e[Release]") // Launching File explorer
var process = Aliases.explorer
var search= process.FindChild(Array("WndCaption"),Array("File Explorer"),200)
process.RefreshMappingInfo()
var addressbar = Aliases.explorer.wndCabinetWClass.WorkerW.ReBarWindow32.AddressBandRoot.progress.BreadcrumbParent.toolbarAddressQuickAccess
Delay(500)
addressbar.Click()
delay(1000)
address = Aliases.explorer.wndCabinetWClass.WorkerW.ReBarWindow32.AddressBandRoot.progress.comboBox
fpath = DDT.CurrentDriver.Value(0)
address.Keys(fpath) // Enter the path in access bar
delay(100)
address.Keys("[Enter]")
delay(1000)
var folderview = Aliases.explorer.wndKBData.KBData.DUIViewWndClassName.Explorer_Pane.CtrlNotifySink.ShellView.Items_View
folderview.Click() // list of all files and folders
folderview.ClickR()
folderview.PopupMenu.Click("SVN Checkout...") // SVN Check out
var p = myapp.WaitWindow("#32770", "Checkout", 1,TIMEOUT)
myapp.RefreshMappingInfo()
var checkout = Aliases.TortoiseProc.dlgCheckout
var URL = Aliases.TortoiseProc.dlgCheckout.cbxURLOfRepository
var urlname = DDT.CurrentDriver.Value(1)
URL.Keys(urlname)
checkout.btnOK.Click()
It works fine on my machine n number of times. But when I run the script using Jenkins on a slave machine
I am getting error of The object "toolbarAddressQuickAccess" does not exist.
Can some one help me with this.
Also I need to search an application is installed on not so I am using below script
Here also it works on my machine but on Jenkins I am always getting
The operation cannot be performed, because the desktop is invisible.
Can someone help me with this also.
// This test case to check SVN is installed or not via DSM
function Check_SVN_Installation()
{
var path
try
{
path = Project.Path
var driverObject = DDT.ExcelDriver(path + "\\Testdata\\SVN_Testdata.xlsx","Appname",true)
while(!driverObject.EOF())
{
Delay(3000)
var process = Aliases.explorer
var search= process.FindChild(Array("WndCaption"),Array("Type here to search"),200) // Search icon on system tray
search.Click()
search.WaitProperty("Exists",true,2000)
process.RefreshMappingInfo()
var appname = DDT.CurrentDriver.Value(0)
Log.Message(appname)
Sys.Desktop.Keys(appname) // enter app name in search key
Log.Message("TortoiseSVN was found")
delay(500)
driverObject.Next()
}
DDT.CloseDriver(driverObject.Name)
}
catch(e)
{
Log.Error(e.message)
}
}
You can open a Word file by using it's COM object. Perhaps, it will be a way you can use to run the needed plugin also.
Here is a sample code to open the file:
'VBScript Set oWord = Sys.OleObject("Word.Application") oWord.Visible = True oWord.Documents.Open "C:\YourFile.doc"