Forum Discussion

denhenp's avatar
denhenp
New Contributor
10 years ago

WPF app with AutomationId.

Hi, 

Im in need of some help, and i hope you wonderfull people can help me out here.

Im trying to use AutomationId in my test scripts, but can't get it working at all. Unless I still use the full path to the objects.

I've been looking through the documentation and the board, but what I have found, did not help me any further - So i hope one of you, can help get me started :)

Im writing the scripts in jscripting .

I have an application where a search button has these properties:
Sys.Process("Blabla1").UIAObject("Blabla2").UIAObject("MainControl").UIAObject("DashBoardView").UIAObject("MainTabControl").UIAObject("Dashboard").UIAObject("CompSearch").UIAObject("Search");
with automationId = SearchButton

If i want to click that button, using automationID, how do I write my script?


I really hope, someone can help me :)

  • it would be something like below

     

    buttonSearch = Sys.Process("Blabla1").UIAObject("Blabla2").FindChild('automationId', 'SearchButton', 20, true);
    buttonSearch.Exists? buttonSearch.ClickButton(): Log.Error('Can not find Search Button');

     

    I have assumed 

    1) Object blabla2 is available at given time

    2) automationId is a property of your button

    3) ClickButton() method is avilable in button. if not you hv to identify similer method

    4) var buttonSearch    defined in function

     

  • NisHera's avatar
    NisHera
    Valued Contributor

    it would be something like below

     

    buttonSearch = Sys.Process("Blabla1").UIAObject("Blabla2").FindChild('automationId', 'SearchButton', 20, true);
    buttonSearch.Exists? buttonSearch.ClickButton(): Log.Error('Can not find Search Button');

     

    I have assumed 

    1) Object blabla2 is available at given time

    2) automationId is a property of your button

    3) ClickButton() method is avilable in button. if not you hv to identify similer method

    4) var buttonSearch    defined in function