Jump to content

IE execscript


JohnOne
 Share

Recommended Posts

<div class="ripdiv">
   <b>links</b>
   <p><a rel="1" onmouseover="document.getElementById(this.rel).style.display='block';" onmouseout="document.getElementById(th         is.rel).style.display='none';" href="javascript:void(0)" onclick="go(405949)">Source #1: <spa         n title="Hosted by friendly1" style="font-style:italic;font-family:impact;font-                size:1         1px;color:#5af;">Vid<span style="color:lightgreen;">Hog</span></span></a><i id="1" style="display: none;">added 8 mon         ths ago<br>by Lem</i></p>
   <p><a rel="2" onmouseover="document.getElementById(this.rel).style.display='block';" onmouseout="document.getElementById(th         is.rel).style.display='none';" href="javascript:void(0)" onclick="go(405950)">Source #2: <spa         n title="Hosted by friendly2" style="font-family:impact;font-size:11px;color:orange;">Mov<span     style="color:#         666;">reel</span></span></a><i id="2">added 8 months ago<br>by Lem</i></p>
   <p><a rel="3" onmouseover="document.getElementById(this.rel).style.display='block';" onmouseout="document.getElementById(th         is.rel).style.display='none';"           href="javascript:void(0)" onclick="go(405951)">Source #3: <spa         n title="Hosted by friendly3" style="letter-spacing:-1px;font-family:impact;font-                size:1         1px;color:#0be;"><span style="color:orangered;">B</span>illion<span style="color:orangered;">U</span>ploads</span></a         ><i id="3">added 8 months ago<br>by Lem</i></p>
   <p><a rel="4" onmouseover="document.getElementById(this.rel).style.display='block';" onmouseout="document.getElementById(this.rel).style.display='none';"            href="javascript:void(0)" onclick="go(405952)">Source #4: <span title="Hosted by friendly4" style="letter-spacing:-1px;font-family:impact;color:white;font-         size:11px;">friend<span style="color:orangered;">UPLOAD</span></span></a><i id="4">added 8 months ago<br>by Lem</i></p>
   <p></p>
</div>

Having a problem trying to navigate by clicking a link which is javascriptvoid(0)

So I'm trying to execute the function belonging to it.

I drill into the frame I need, then...

$videoframe.document.parentwindow.execScript("go(405949);", "javascript")

It works, but only if my mouse is physically over the frame from which the function is executed.

Anyone know why is this, and how can I address it?

Sorry for the poorly formatted code.

EDIT:

I am able to use _IELinkClickByText() and _IEAction($o, "click")

But still, both do not complete the navigation unless my mouse is hovering within the boundries of the frame in which the element is located.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Thanks for input.

Does not appear to work for me though, giving a com error.

----> $ErrorScriptline = 116

----> $ErrorNumberHex = 80020006

----> $ErrorNumber = -2147352570

----> $ErrorWinDescription = Unknown name.

----> $ErrorDescription =

----> $ErrorSource =

----> $ErrorHelpFile =

----> $ErrorHelpContext = 0

----> $ErrorLastDllError = 0

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

For reference, since eval is javascript, it needs to be written like so.

.document.parentwindow.execScript('eval("go(405949)")')

Same issue for me though, mouse has to be physically present.

EDIT:

perhaps not in IE 11

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

ControlClick does not work (I know it's hitting the link because It changes colour like it's been clicked)

After focusing link (works) with _IEACtion(.,.) Controlsend with {ENTER} does not work either.

So what I'm looking for here is another way to fool the browser into thinking the mouse is present.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Have you tried caling this go function from ie console?

Second thought: Each element on your site has onmouseover element. Maybe function go is defined to check if element is visible or not (have no idea why would anybody do that, but...)

Try to find source of go function.

Link to comment
Share on other sites

function go(a){f.iqs.value&&((w=window.open("",""))||alert("To proceed, you must allow popups"));window.XMLHttpRequest?r=new XMLHttpRequest:window.ActiveXObject&&(r=new ActiveXObject("Microsoft.XMLHTTP"));if(r)f.lastChild.value="37fn8Oklq",a="id="+a+"&s="+s+"&iqs="+f.iqs.value+"&url="+f.url.value+"&m="+m+"&cin="+f.cinny.value+"&sec="+f.secret.value+"&t=7295",r.open("POST","/membersonly/components/com_player/video.phpAjaxResp.php",!0),
r.onreadystatechange=ice_b,r.setRequestHeader("Content-type","application/x-www-form-urlencoded"),r.send(a)

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

You may have to manually file mouseover or blur events.  Look for the .fireEvent method

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Sorry Dale, should have mentioned, I read your suggesstions of firing events in some other similar threads.

The fired events work, because the page responds, for example onmouseover will display a text underneath the link.

But unfortunately they have no positive effect.

Thanks.

I've a feeling that it's checking the physical location of the mouse on page, just hoping someone might know of a workaround.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

sounds like brain teaser, send that link 2 me 2 :)

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

The site is checking the value of a javascript variable and will only proceed if it is below a specific number.

This modified version of your code works for me:

#include <ie.au3>

$oIE = _IEAttach("Blade Runner")

$videoframe = _IEFrameGetObjByName($oIE, "videoframe")

$srclist = _IEGetObjById($videoframe, "srclist")

Local $ripdiv = 0
Local $oElements = _IETagNameGetCollection($srclist, "div")

For $oElement In $oElements
    If $oElement.className == 'ripdiv' Then

        ;MsgBox(0, "Element Info", "Tagname: " & $oElement.tagname & @CR & "className: " & $oElement.className)
        $ripdiv = $oElement
        ExitLoop
    EndIf
Next

If Not IsObj($ripdiv) Then
    Exit MsgBox(0, "Error", "className error: " & @error)
EndIf

$videoframe.document.parentwindow.execScript("m=-20;", "javascript")

    $oLinks = _IETagNameGetCollection($ripdiv, "a")
    For $link In $oLinks
        If StringInStr($link.innertext, "180") Then
            $link.click()
            _IEAction($link, "click")

            Exit
        EndIf
    Next
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...