Excel VBA click a cell in a table controlled by javascript -


i trying create web query excel ran bit of snag. figured out how log web page , click link go right portalid. having trouble getting specific reports.

to specific reports, need click link in table appears use javascript. html table below. there 10 cells in table keep code light included first 2 cells. can see, each cell has own unique id can filter correct cell element vba. cannot seem figure out how click cell.

<table submenu='1' border='0' cellpadding='6' cellspacing='0'  id='ctl02n4c73594f1bf740b982340da2a792ff62_mainm'   class="ctl02n4c73594f1bf740b982340da2a792ff62island"    style=' background:#141311; border-width:0px; width:100%;   cursor:default;' onselectstart="javascript:igmenu_selectstart();"   onmouseover="javascript:igmenu_mouseover(this, event);"   onmouseout="javascript:igmenu_mouseout(this, event);"   onmousedown="javascript:igmenu_mousedown(this, event);"   onmouseup="javascript:igmenu_mouseup(this, event);"iglevel='0'>   <tr>     <td align='center' id='ctl02n4c73594f1bf740b982340da2a792ff62_1'       igtag='4eddf201-f6ed-4e11-b2ff-6a742128909c'        class="n_4c73594f_1bf7_40b9_8234_0da2a792ff62_class"style="       white-space: nowrap; ;" ighov='n_4c73594f_1bf7_40b9_8234_0da2a792ff62_hover'       igtop='1'>welcome</td>     <td align='center' id='ctl02n4c73594f1bf740b982340da2a792ff62_2'       igtag='e0d4474e-87f8-42cc-ab47-38751029052d'        class="n_4c73594f_1bf7_40b9_8234_0da2a792ff62_class"style="       white-space: nowrap; ;" ighov='n_4c73594f_1bf7_40b9_8234_0da2a792ff62_hover'       igtop='1'>dashboard</td>   </tr> </table> 

here vba direct cell need click. looks need invoke "onmouseup" event of table. how "link" cell need onmouseup event of table?

sub clicktable(tofind string, ie object) '"tofind" id of cell find, ie ie application dim iedoc object 'iedocdocument dim tdcollection object 'table has javascript events , contains                             cells want click dim cell object 'specific "clickable" cell in table "click"      set iedoc = ie.document     set tdcollection = iedoc.getelementbyid("ctl02n4c73594f1bf740b982340da2a792ff62_mainm").getelementsbytagname("td")     each cell in tdcollection         if cell.id = tofind             cell.click             exit sub         end if     next  end sub 

well, while searching other vba/javascript questions figured out on own!

i went through javascript code see how html events tied javascript , sure enough, "onmouseup" requires "onmousedown" requires "onmouseover". here trying execute final interaction , didn't think of breaking down javascript code.

so, if else runs issue trying click cell in javascript controlled table menu, may need execute ways mouse interacts page depending on how javascript written.

here final code worked.

sub clicktable(tofind string, ie object) 'tofind id of element find, ie ie application dim iedoc object 'iedocdocument dim tdcollection object 'table has javascript attributes , contains element want click dim cell object 'specific "clickable" cell in table test          set iedoc = ie.document         set tdcollection = iedoc.getelementbyid("ctl02n4c73594f1bf740b982340da2a792ff62_mainm").getelementsbytagname("td")         each cell in tdcollection             if cell.id = tofind                 cell.fireevent ("onmouseover")                 cell.fireevent ("onmousedown")                 cell.fireevent ("onmouseup")                 exit sub             end if         next      end sub 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -