如何使用Applescript在Firefox中填写文本字段?

时间:2012-07-18 04:12:37

标签: applescript

我很高兴在我的日子里工作......突然之间我想查看我的史考特帐户,但是我懒得记住密码,所以我有这个小的Applescript应该通过打开登录我的帐户只是我当前Firefox中的一个新选项卡。它一直有效,直到它试图填充帐户/密码...并且它失败,因为帐户文本字段最初没有焦点。
这是我到目前为止所做的:

tell application "Firefox" to open location "http://www.scottrade.com/"
delay 1
tell application "System Events"
tell application process "Firefox"
    set frontmost to true
    delay 1
    -- Since the fields are not with the cursor in it
    -- this will not work….
    -- field name is "account"
    keystroke "12345678"
    keystroke tab
    -- field name is "password"
    keystroke "abcd1234"
    keystroke return

    -- could probably use something like this, however window 1 doesnt ring a bell
    set contents of text field "account" of window 1 to "Hello, World."
end tell
end tell

0 个答案:

没有答案
相关问题