none
How to write VBA to hover over an HTML element RRS feed

  • Question

  • I am trying to extract some elements from an external website.  Unfortunately these elements only displayed when mouse hover over a particular item.  An abbreviated example of such an HTML code might be:

    <ul id='table' class="table">
        <li>1</li>
        <li>2</li>
    </ul>

    <script type="text/javascript">
    $(function() {
    $('.table li').hover(function(){$(this).append("<ul id='testlist'> <li><a href='#'> first child</a> </li> <li><a href='#'> second child</a> </li>")},  function() {$('#testlist').remove()} 

    In the above example, I wanted to extract "first child" and "second child".  However a code like:

    set get_table = IE.document.getelementsbyname("testlist") will fail, as "testlist" only appears when mouse hover over any of the "li" element.

    My question is how to force the mouse to hover over an HTML element so that I can access "testlist" to retrieve child elements?

    Wednesday, June 25, 2014 8:27 AM