applescript - Javascript to fill a formatted text field on a web site -


i know virtually nothing javascript. monkey-see, monkey-do approach i’ve managed use javascript within applescript/safari fill text fields on web-site using following command:

do javascript "document.getelementbyid('elementid').value ='texttoenter';" in document 1 

i’ve been able enter text fields except one. fields work labeled input type="text”. field doesn’t work complex in entered text can formatted (bold, italics, underline, alignment, etc.) after entry. assuming i’ve identified correct source code element looks follows prior text entry:

<body id="tinymce" class="mce-content-body " onload="window.parent.tinymce.get('fax_text').fire('load');" contenteditable="true" spellcheck="false"><p><br data-mce-bogus="1"></p></body> 

depending on how viewed, p , br tags appear on separate lines otherwise identical.

after manual entry of text (“insert text here”) directly web page's text field source code becomes:

<body id="tinymce" class="mce-content-body " onload="window.parent.tinymce.get('fax_text').fire('load');" contenteditable="true" spellcheck="false"><p>insert text here</p></body> 

the following did not work (wrapped in applescript):

document.getelementbyid('tinymce').value ='insert text here'; 

it produces error: "missing value".

as per @whitehat, following n= 0-4 inserted text @ several spots on page not in targeted text field; n > 4 resulted in "missing value" error:

document.getelementsbytagname('p')[n].innerhtml ='insert text here'; 

i tried targeting br tag no avail. how target text field javascript? note: not need format entered text.

this text field in iframe. iframe contains html document (<html><head><body>).

to document, need the_iframe.contentdocument.

do javascript "var ifr = document.getelementbyid('fax_text_ifr'); ifr.contentdocument.getelementsbytagname('p')[0].innerhtml = 'some text';" in document 1 

Comments

  1. Hi Admin,

    There is javascript to fill a formatted text which is helping for the javascript in text entry.

    Regards,

    Dentist In Chicopee

    ReplyDelete

Post a Comment

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -