Though I have been using Mac's for quite a few years and using AppleScripts for few basic needs, I had been troubled by a problem at work for sometime and wanted to see if I could get some kind of solution here. I am a software tester in Macintosh domain and here is my problem.
PROBLEM
I need to automate an application say "MyApp" whose UI is being worked upon while I am expected to write up the required applescripts to reduce the time taken during regression. As the time between final UI version and time to finish testing is less, I need to write the scripts as the UI is being developed and fix the scripts in case they get broken due to change in UI.
The major problem I face is my 20 odd scripts get ready and developer changes the UI layout a bit which totally breaks all my scripts and I end up sitting long hours "tweaking" all my scripts. The changes are trivial but they end up taking a lot of time. Here's an example:
Code BEFORE UI change:
click button "Click here" of group 1 of group 2 of group 1 of window "MyApp"
Code AFTER UI change:
click button "Click here" of group 1 of group 1 of group 2 of group 1 of window "MyApp"
As you can see, the change was that the button has been embedded in an additional group (initially there were 3 but then it became 4). Though this change is trivial, it affects all my scripts and I end up updating all scripts manually.
MY QUESTION
I toyed with an idea to list all my application controls in one library as variables and then refer to those variables through all of my scripts thereby, insulating me from changing them everywhere. If developer changes the UI, all I have to do is change one library and all scripts still work.
However, I am unable to implement this successfully as I can not find a way to make my scripts successfully access the control info from outside the script.
I was hoping that I would be able to do something like this:
Library: set bttnClickHere as "button \"Click here\" of group 1 of group 1 of group 2 of group 1 of window \"MyApp\""
My Script code: click Lib's bttnClickHere
This way, even if the button is embedded in another group, I have to change one variable and all my scripts remain untouched.
I am not sure if what I envision is possible or not, or if I am doing something wrong...would really appreciate any help/direction in this problem of mine.
Thanks in advance!
Rahul.