Forum Discussion

ChandanD's avatar
ChandanD
Contributor
5 years ago

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"

     

  • BenoitB's avatar
    BenoitB
    Community Hero

    Does your machine is locked ? Do you have desktop screen activated on ?

    I'll check the desktop is invisible for both problems

  • I am also facing one more problem with Jenkins. 

    When I am trying to open the .xls file it is working in my machine because I have enabled option of enabling file name extension so below is the code which I am using

     var serword = win10folder.FindChild(Array("Value"),Array("Word_test.docx"),500)
       serword.DblClick() // newly created word document is opened.

     but on my Jenkins slave the file name extension is disabled for it gives me error cannot find the object with Find Child so I have to remove the extension and then it works. 

    I tried by giving *.* but still it fails. 

    Is there any way where I can find it even if it has .docx or not