AppleScript JavaScript getElements I have my script partially working. I'm using AppleScript to script interactions with Chrome.

set textToSave to "Text"

tell application "Google Chrome"
    execute front window's tab 1 javascript "document.getElementsByName('0.9.7.1.5.0.4.1.3')[0].click();"
    delay 0.1



If I enter a multiple line textToSave for example 

" here
blabla 

bla"


then I have no text and --> missing value
I need to set a popup field before this script, here is the HTML for it 

&lt;select id="PaymentEnSelection" name="0.9.7.1.5.9.4.1.9"&gt; &lt;option selected="selected" value="0"&gt;Enabled&lt;/option&gt; &lt;option value="1"&gt;Disabled&lt;/option&gt;&lt;/select&gt;


and a another one :

&lt;select name="0.9.7.1.9.0.4.1.9.0.2.1.3.7.3.9.3.1"&gt;&lt;option value="NoSelectionString"&gt;Please select a reason&lt;/option&gt;
&lt;option value="0"&gt;R1&lt;/option&gt;
&lt;option value="1"&gt;&amp;amp; Review &lt;/option&gt;
&lt;option value="2"&gt;Chart&lt;/option&gt;
&lt;option value="3"&gt;R3&lt;/option&gt;
Multiline text can be achieved using either of the following methods:


Separate the text by new lines, with the first quote and last quote encapsulating the contents.


Use \n as new line.

set myvar to "hello\nanother\n\nfinal"



You can set the value of a select element using the following JavaScript

document.getElementById("PaymentEnSelection").value = 1


The value given is one of the value attributes on the option elements that you wish to select.