cancel
Showing results for 
Search instead for 
Did you mean: 

Opening a specific path using Test Complete

SOLVED
Highlighted
Contributor

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)

  }
}
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

Re: Opening a specific path using Test Complete

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"

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

14 REPLIES 14
Highlighted
Community Leader

Re: Opening a specific path using Test Complete

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

I'll check the desktop is invisible for both problems

Un sourire et ça repart

Highlighted
Contributor

Re: Opening a specific path using Test Complete

The desktop is not locked. But when I take remote connection of the PC and watch the execution the scripts works.

I don't know the reason for it.

Highlighted
Contributor

Re: Opening a specific path using Test Complete

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

Highlighted
Community Leader

Re: Opening a specific path using Test Complete


@ChandanD wrote:

The desktop is not locked. But when I take remote connection of the PC and watch the execution the scripts works.

As i said that's the reason, when your are not connected the desktop screen is hidden/locked.

 

Hint here :

https://support.smartbear.com/testcomplete/docs/testing-with/running/via-rdp/in-minimized-window.htm...

 

 

 

Un sourire et ça repart

Highlighted
Contributor

Re: Opening a specific path using Test Complete

I added the Dword in registry. The desktop visible error is gone. 

But I received error Objeect not found for accessbar

Highlighted
Community Leader

Re: Opening a specific path using Test Complete

At least one point done 😉

 

For object not found, perhaps because not exact same version of Windows ?

And check also if Explorer options are identical.

 

Un sourire et ça repart

Highlighted
Contributor

Re: Opening a specific path using Test Complete

Hello,

 

Both the system have same operating systems (Win 10). I am using Test Complete to develop the script and Jenkins have Test Execute to run the scripts.

File Explorer is also the same as you can see from my script I am calling Windows +E to launch it which is common.

So I am not getting any clue what is happening. I cannot always watch the execution and say the scripts are getting passed or the build job is getting passed.

If there is some solution like launching the explorer using aqtime or Scripting.FileSystem please let me know.

Highlighted
Community Manager

Re: Opening a specific path using Test Complete

Hi @ChandanD,

Is there any specific reason why you open a file via Window Explorer? TestComplete has some special features to open the needed file, like aqFile.OpenTextFile.

Also, TestComplete provides the OpenFile method that opens the file from the application's File | Open main menu

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Contributor

Re: Opening a specific path using Test Complete

The reason I want to open file explorer is I have to automate the Tortoise SVN process.

Like go to a specific folder path. Do checkout

Launch Word document and perform subversion actions of commit

Launch excel sheet and perform subversion actions of add, lock

so to go to specific folder path and right click to perform tortoise svn functions. 

 

The scripts are designed and working on local machine. The problem is with Jenkins slave only where I'm facing issues.

New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
Let's start July with new challenges!

Create a script to pass custom command-line arguments as a test parameter for the TechCorner tag!

Will you dare to take the challenge?


Top Kudoed Authors