Forum Discussion

Rajesh2's avatar
Rajesh2
Contributor
8 years ago

How to perform action using Excel data in TestComplete with Python

Greetings,

 

As i am new to Python and Python with TestComplete. Can anyone please explain how to handle this?

 

Scenario:

I am storing "ControlID", "Type", "Action", "Data" in my excel sheet. 

I need to find the ControlID from one python class and from the other class i need to  perform actions based on controlID

ex:

class Common():

  def FindCtrlID():

     Find the controlID from Excel

 

class test():

   def Navigate_Str():

      Find the control ID from Common Class

        if type==button & Action==Click

           CtrlId.click()

        elif type==textbox & Action==Sendkeys

           CtrlID.Sendkeys(Data from Excel)

 

NOTE: Excel file is attached

2 Replies

  • shankar_r's avatar
    shankar_r
    Community Hero

    I'm not python script-er but as far as i know if you declare the variable as Global then you will able find the value from one class to another.

     

    Like blow in your code:

     

     

    class Common():
    
      def FindCtrlID():
    
         global controlID = "find from excel sheet"
    
     
    
    class test():
    
       def Navigate_Str():
    
          Find the control ID from Common Class
            Log.Message(controlID)
            if type==button & Action==Click
    
               CtrlId.click()
    
            elif type==textbox & Action==Sendkeys
    
               CtrlID.Sendkeys(Data from Excel)

     

    For getting values from Excel you ca refer here https://support.smartbear.com/testcomplete/docs/testing-with/data-driven/drivers.html