applescript not accessing iframe on page

i’ve got a script that takes info out of a Filemaker database and fills in an online form. The problem is that the website has an ‘encrypted’ iframe where the form is. so, applescript doesn’t recognize those fields by id, name, tag…etc because it’s not seeing inside the iframe. The problem is that the iframe source’s address changes all the time. i’m assuming it’s some kind of encyrption or something so that people can’t get directly to that page. so, i’ve tried scripting chrome and safari both, and neither work. oh, and i forgot to mention that the iframe itself doesn’t even have a name or id assigned to it either. :frowning: am i just completely screwed?

ok…so, after 2 solid days of trying to figure this out…i still can’t. so, i had to look at doing some kind of work around. came up with this and it’s working, but still hoping someone can help me figure out how to directly set the fields inside the iframe.

as of right now though, i’m just having the page load, then having this:

set t to (execute javascript "document.getElementsByTagName('html')[0].innerHTML") as text

pull the source of the iframe, then searching through the variable for the iframe source address with:


if t contains "***text to look for***" then
	set idNumber to text ((offset of "***text to look for***" in t) + 29) thru ((offset of "***text to look for***" in t) + 700) of t

which gives me the rest of the encrypted address. then i just open that address and i’m able to fill the form from there. so, it’s now a much longer process (and ugly), but at least it works.

and if this helps, this is the code from the site that has the iframe in it:


as you can see, there’s no id, or name set to the iframe, so calling it with javascript to focus on it seems to be impossible (unless someone knows of another way to do it)

but, if someone does, here is one of the fields that i’m trying to access:

but, using:


execute javascript "document.forms['Form1']['ReportViewer_ctl04_ctl03_ddValue'].value = '2'"

doesn’t work, nor does a getelementsbyid.

Hi JiXeR,
I had this very same problem a while ago and let me just say, I feel your pain! You have gone to much more trouble than I did to solve this problem and I commend you for coming up with a solution. As for me, I did another work around by accessing the desired form through a back way to the website in question. In my case it was a log in via an iframe but if I clicked on a link that said “I forgot my password” or something, it took me to a different log-in place which did not use the iframe.
David