Forum Discussion

jchapman's avatar
jchapman
Occasional Contributor
9 years ago
Solved

Determine when no liscense is available using COM (python)

I am using a modified version of the script I found here to run TestComplete and TestExecute, related code follows:

 

from win32com.client import Dispatch
import pywintypes

...

try: self.test_complete = Dispatch("TestExecute.TestExecuteApplication") except pywintypes.com_error: try: self.test_complete = Dispatch("TestComplete.TestCompleteApplication") except pywintypes.com_error: sys.exit("TestComplete/TestExecute not found")

However I have an issue when there are no avaiable licenses. After calling Dispatch a dialog pops up (image below) and the Dispatch call blocks.

te.png

 

This breaks all the automation I've been trying to do with TC/TE, and I'm looking for a way to determine before calling the Dispatch that no liscenses are avaiable.

 

Thanks

7 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Jchapman,

     

    As far as I remember, it’s impossible to get this information when working with TestComplete via COM.

     

    However, you can get the list of all consumed licenses on this page. Perhaps, you can create a Python script that will send an HTTP request to this page, get the response and pass it in a way you need.

    • jchapman's avatar
      jchapman
      Occasional Contributor

      Thanks for your reply, 

       

      It seems like I need to navigate to Features>Test Execute 11 to find the information I'm looking for. The URL that has this information has three id's: haspid, vendorid, and productid. Do you know if these will differ for users on the same network? Also are any of these unique to our installation/liscense server? 

       

       

      If this works I'll post a code snipit.

       

      Thanks, 

       

      Jordan

    • jchapman's avatar
      jchapman
      Occasional Contributor

      It also appears that the local webpage doesn't update until you try to run TestExecute. If someone else had the liscense it may say that there is a liscense availabe until you try and run TestExecute.

       

      What I can do is go to the liscense server's web interface, that staus seems to update much quicker. However I'm now running into the issue that the table is populated via javascript, so I need to get the contets of the page after javascript has populated the table. 

  • jchapman's avatar
    jchapman
    Occasional Contributor

    There are too many blocking dialogs when running TestExecute (or TestComplete) via COM. There is a blocking dialog when there are no avaiable licenses, there's one to update TestExecute itself, and there's even one to update Firefox! 

     

    When running TestExecute via the COM interface there is no way to know what has happened, the dialogs just block the Dispatch call. 

     

    I can (try to (race condition)) to determine if there is a license available before running TestExecute. 

     

    How can I prevent the other pop ups?