PDA

View Full Version : Internet automation specific 'tinymce' textfield



Jer3miah
11-23-2017, 08:28 AM
Hi,

I'm trying to populate one of 5 identical-looking text fields on a webpage; it looks like this:

21029

Using Chrome's element inspector I've determined the associated code to be:
(Green is the iframe and pruple is the 'tinymce' text field element)

21030

All the textfields on the page are within their own iframe;
each iframe has a unique id, all the textfields have the same id (tinymce) but a unique data-id parameter.

This is the code I'm using (I've removed the part where I log-in to get to this text field):


'Declare
Dim IE AsObject

'Open Internet and navigate
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible =True
IE.navigate "https://beheer.ingoedebanen.nl/10"
'Code to wait for the page to load (Format Tags kept messing it up)

'Populate text field
IE.Document.parentWindow.execScript "tinyMCE.activeEditor.setContent('" & "It worked!" & "');", "javaScript"


The text: 'It Worked!' did show up in one of the text fields on the webpage, just not the one I wanted.
I realise I've never specified what textfield I want to populate in the code, but I'm clueless as to how I would do this.
I did find "doc.frames("iframename")" online, which allows differentiating between iframes;
But the only thing that's different across all these iframes is the id, and I don't see a name attribute.

All help is greatly appreciated!
- Jeremy

SamT
11-24-2017, 11:50 AM
Moderator Bump

IIRC, all IE elements have a unique id, so you should be able to access :dunno: maybe IE.Elements(id#)