Ask a Question

How to click after finding an object

SOLVED
Rajesh2
Contributor

How to click after finding an object

Hi All,

 

I need to perform some action after finding an object using Find, FindAll or FindChildren methods. 

 

Can anyone please explain how to go about this?

 

Like click on the object after finding it using Find or FindAll methods.

 

I have gone through the smartbear website for find and findAll. But it didnt help.

 

I tried with this code:

 

def clickControlID():
  TestedApps.Sound_PE.Run()
  Delay(5000)
  Login=Sys.Process("SoundPE").WinFormsObject("DialogLogin")
  clkLogin=Login.FindAllChildren("WinFormsControlName","buttonOK",20)
  clkLogin.Click()

 

I am getting the error for this code as:

AttributeError:
'SafeArrayWrapper' object has no attribute 'Click'
4 REPLIES 4
shankar_r
Community Hero

try this,

 

def clickControlID():
  TestedApps.Sound_PE.Run()
  Delay(5000)
  Login=Sys.Process("SoundPE").WinFormsObject("DialogLogin")
  clkLogin=Login.FindAllChildren("WinFormsControlName","buttonOK",20)
Sys.HighlightObject(clkLogin)

 

let me know you are able to identify the object.

 

If you are able to highlight the object then you put a breakpoint on the Sys.HighlightObject(clkLogin) and add clkLogin in the watch list and see what is the properties you got.


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

Hi @shankar_r I am getting error as "Type Mismatch"

baxatob
Community Hero

clkLogin=Login.FindAllChildren("WinFormsControlName","buttonOK",20)

 

FindAllChildren() will return an array of objects. 

 

Click() method can be performed only on single object. 

You need to use Find() or FindChild() method or select appropriate object from the returned array.

Thank you @baxatob.. Its working absolutely fine now.. 

cancel
Showing results for 
Search instead for 
Did you mean: