Hi,
I'm creating a script that is going to navigate through a webpage and record the time it takes to do certain stuff.
The problem I'm having is that there is javascript that edits the source code and adds the link I need to click but I can't click the element for some reason.
The original source code when the page is loaded:
<SPAN style="Z-INDEX: 100; COLOR: black" id=treeDiv class=smallDescription>
<DIV style="POSITION: absolute; WIDTH: 150px; TOP: 76px; LEFT: 10px" class=hide>Laddar menyn... </DIV>
</SPAN>
Ps. "Laddar menyn..." equals "Loading menu..." in Swedish.
And when the menu is loaded it's a bunch of divs with onclick attributes. For example:
<div style="z-index: 11; padding-left: 0pt; background-position: 120px 3px; background-image: url(/skins/Riksbyggen/images/i1.gif); padding-top: 1px; background-repeat: no-repeat; visibility: visible; top: 228px; left: 8px; background-color: rgb(213, 2, 2); color: white;" onmouseover="nodem8b1f22570b5f41e1a8ec997f4ecbcd50.mouseover()" onmouseout="nodem8b1f22570b5f41e1a8ec997f4ecbcd50.mouseout()" class="menuItem" id="divm8b1f22570b5f41e1a8ec997f4ecbcd50" onclick="nodem8b1f22570b5f41e1a8ec997f4ecbcd50.changeLoc();return false"> <img hspace="4" align="absMiddle" src="/menu/images/extLink.gif" class="extLinkImg"/>Edit menu</div>
I can't get the div with:
$oDiv = _IEGetObjById ($oIE, "divm8b1f22570b5f41e1a8ec997f4ecbcd50")
And I can't execute the onclick with:
$oIE.document.parentwindow.execScript('nodem8b1f22570b5f41e1a8ec997f4ecbcd50.changeLoc();return false')
I even tried making a exact copy of the div and clicking that element:
$sHTML = _IEDocReadHTML($oIE)
$sHTML = $sHTML & '<div style="z-index: 11; padding-left: 0pt; background-position: 120px 3px; background-image: url(/skins/Riksbyggen/images/i1.gif); padding-top: 1px; background-repeat: no-repeat; visibility: visible; top: 228px; left: 8px; background-color: rgb(213, 2, 2); color: white;" onmouseover="nodem8b1f22570b5f41e1a8ec997f4ecbcd50.mouseover()" onmouseout="nodem8b1f22570b5f41e1a8ec997f4ecbcd50.mouseout()" class="menuItem" id="divm8b1f22570b5f41e1a8ec997f4ecbcd50" onclick="nodem8b1f22570b5f41e1a8ec997f4ecbcd50.changeLoc();return false"> <img hspace="4" align="absMiddle" src="/menu/images/extLink.gif" class="extLinkImg"/>EleFHant</div>'
_IEDocWriteHTML ($oIE, $sHTML)
But nothing works. Someone plese help me?
Ps. It doesn't help if I wait with Sleep(5000) for the menu to load, it's still the same issue.