1
$\begingroup$

If the element is not inside an iframe then the following works:

WebExecute["LocateElements"->"XPath"->"//*[@id=\"select-page\"]"]

I can gain access to the same element via Javascript:

WebExecute[
    "JavascriptExecute"->"return document.getElementById('select-page')"
]

But If the element is inside an iframe as follows:

<iframe id="whiteboard-frame" scrolling="no" seamless="seamless" allowfullscreen="true" style="overflow-y: hidden; border-width:0px; width:100%; height: 100%; padding:0px; margin:0px;" src="...">
   #document

...

<li class="draw-tool-li" id="tool-select-page" style="display: list-item;">
    <select id="select-page" class="tooltip tooltipstered">
        <option value="0">Page 1</option>
        <option value="1">Page 2</option>
        <option value="2">Page 3</option>
        <option value="3">Page 4</option>
        <option value="4">Page 5</option>
        <option value="5">Page 6</option>
        <option value="6">Page 7</option>
        <option value="7">Page 8</option>
        <option value="8">Page 9</option>
        <option value="9">Page 10</option>
        <option value="10">Page 11</option>
        <option value="11">Page 12</option>
        <option value="12">Page 13</option>
        <option value="13">Page 14</option>
        <option value="14">Page 15</option>
        <option value="15">Page 16</option>
        <option value="16">Page 17</option>
        <option value="17">Page 18</option>
        <option value="18">Page 19</option>
        <option value="19">Page 20</option>
        <option value="20">Page 21</option>
        <option value="21">Page 22</option>
        <option value="22">Page 23</option>
        <option value="23">Page 24</option>
        <option value="24">Page 25</option>
        <option value="25">Page 26</option>
        <option value="26">Page 27</option>
        <option value="27">Page 28</option>
    </select>
</li>

...

</iframe>

I am trying the following but failing:

WebExecute[
    "JavascriptExecute"->"var iframe = document.getElementById('whiteboard-frame'); return iframe.contentDocument.getElementById('select-page');"
]

Somebody, please tell me what am I doing wrong?

$\endgroup$

0

This site is temporarily in read-only mode and not accepting new answers.

Browse other questions tagged .