Re: Safari: When do changes to a <textarea> show up in AppleScript "get the text..."
Re: Safari: When do changes to a <textarea> show up in AppleScript "get the text..."
- Subject: Re: Safari: When do changes to a <textarea> show up in AppleScript "get the text..."
- From: Roger Howard <email@hidden>
- Date: Tue, 20 Oct 2009 14:55:28 -0700
On Oct 20, 2009, at 2:43 PM, Mark J. Reed wrote:
Never. The initial contents only appear because they're part of the
HTML source of the page. To get changes after the page is loaded,
you'll have to use JavaScript.
A web page is an in-memory object tree that is initialized from the
HTML, but not maintained in HTML form when it changes.
Ahhh, just beat me to it. What Mark said...
HOWEVER - it is possible to get the *current* contents of a text field
via the "do JavaScript" command in Safari... this is reaching into the
in-memory state of the page to inspect (and even modify) the state of
the DOM.
For instance, the following AppleScript+JavaScript snippet will get
the contents of a textarea whose name is "sometext" within a form
named "someform" and put it in an AppleScript variable named
theTextAreaValue.
-----------
tell application "Safari"
tell document 1
set theTextAreaValue to do JavaScript
"document.someform.sometext.value"
end tell
end tell
-----------
HTH,
Roger
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden