Hi Dan,
I've done this in C# using 'WatiN' http://watin.sourceforge.net and also in Python using 'pywinauto' http://pywinauto.openqa.org and PAMIE < http://sourceforge.net/projects/pamie%3E. The WatiN page also references a project for ruby called Watir http://wtr.rubyforge.org but I have not used it.
I haven't done this kind of thing from a Mac.
Watir works on Mac, but like I said, I have not tried it. That would be my first approach if I were working from a Mac.
One thing which helps alot is a Firefox plugin called 'Firebug' < http://www.getfirebug.com%3E. It can help you quickly navigae javascript and identify elements of interest in page source. (There's also a devloper toolbar for IE which fills a similar need, but I haven't seen anything for Safari...)
Happy hacking!
-Loren
On Sun, Jan 11, 2009 at 7:18 PM, Dan Martin ummar143@shaw.ca wrote:
Problem: to automatically fill form fields in a web page based on changing criteria.
I am sure this problem crops up in a number of areas. In my case, I place buy and sell orders (different variations) for stocks on my broker's web page. By the time I enter all the info and go through one or two confirmatory screens, the price has often changed and the order cannot be executed.
I would like to have a script that would offer me a choice of trading account and stock to select. It would then calculate how many shares I could afford from the given account, and enter the info into the web page and subsequent pages, perhaps stopping before the very final confirmation. Ideally, I would like visual confirmation of what has happened.
It appears that the broker's web page (https) contains Java script forms.
Possible Solutions:
- Use Applescript to control the Safari web browser on my Mac.
Applescript can call a bash shell (or vice versa) to allow programmed control. 2) A perl script using "mech" (WWW::Mechanize). 3) A script which calls curl. 4) other?
I am unfamiliar with these technologies, and I have only a vague idea about how they would work.
Does anyone have suggestions on these or other approaches?
Dan Martin GP Hospital Practitioner Computer Scientist ummar143@shaw.ca (204) 831-1746 until Jan 21: (204) 219-6685 answering machine always on
Roundtable mailing list Roundtable@muug.mb.ca http://www.muug.mb.ca/mailman/listinfo/roundtable