开发者

Automate browser tasks with Cocoa?

Is it possible to build a pro开发者_Go百科gram which could automate browser tasks? For example; filling out forms which i have to do every day at work... Wanted to try and find an automated way of doing this instead :)

If it is possible, where should i start reading? Any guidance is much, much appreciated!

Thanks guys & happy Friday to you all.


Applescript lets you use the keyboard programmatically so you should be able to navigate through the form with Tab, enter text and submit the form with Enter.

You can use the sleep command to make sure you're not typing too fast.

Example

tell application "Safari"
    activate
    make new document at end of documents
    set url of document 1 to "http://www.example.com/"
    sleep 5 -- Give it 5 seconds to load the page
end tell
tell application "System Events"
    keystroke tab
    sleep 1
    keystroke "foo"
    ...
end tell


I made something similar to this a few years ago. But I've solved this wie applescript. Perhaps you should read a little bit about it. It's very easy and useful.


You should try the web browser Fake.

Its tagline is: Mac OS X Web Automation and Testing Made Simple.
You can see it as a combo of Safari and Automator in one app.

Automate browser tasks with Cocoa?

Extract from its site:

Power Users will love Fake for automating tedious web tasks like filling out lengthy forms and capturing screenshots.

The workflow library is really powerful, and the killer feature for me is the Command-Click and Drag to connect to an element from your webpage without having to specify its id.

Get it at: http://fakeapp.com/ [Free trial, $29.95.]


http://sikuli.org/ is a great app for automating tasks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜