Jump to content

How to access to a window javascript object


kosto
 Share

Recommended Posts

Dear all,

First of all I apologize if my English is not good (I'm Spanish). There is a webpage that provide some services and I want to automate some tasks with an autoit script.

The problem that I have is that the webpage is using the window object of javascript to show a second layer where a different webpage is opened and it contains all the links that I need to click in.

The Internet Explorer only shows 1 page and I'm able to attach to this page, but all the information that I obtain is related to the 1st layer. I don't know how to access to the 2nd layer that contains the interesting information.

I've been playing with the _IEAttach.au3 that is provided with the autoit package but I haven't obtain any result. I try the following options:

* $oIE = _IEAttach ("<url of the second layer>", "url")

* $oIE = _IEAttach ("<some text of the second layer>", "text")

* $oIE = _IEAttach ("<The caption of the second layer>", "embedded")

Also I used the Autoit Window Info tool to try to discover something, and it seems that is the same IE window.

Have anybody any idea about how I can access to this second layer?

Regards,

Kosto

Link to comment
Share on other sites

Welcome to the Forums!

Is this page a page that we can access? As in you could give us the URL so we could go look at it?

If not, can you post the HTML of the page? There's a lot of different ways code things when making webpages, without knowing how they're doing what they're doing we won't be able to make even a qualified guess at how to do what you wanna do.

Link to comment
Share on other sites

Exodius thanks for your help. To see this behaviour you can go to http://www.apan.net/tools/grey/examples.html. This page contains some examples of a javascript code called GreyBox that shows pop-ups in a funny way.

The following code clicks on the last link that opens a new layer with a google page. I want to do a simple query in that layer.

#include <IE.au3>

$oIE = _IECreate ("http://www.apan.net/tools/grey/examples.html")
_IELinkClickByText ($oIE, "Visit Google without loading")

;Some tries to attach to the popup

;Msgbox (0, "K", $oIE)
;$oIE = _IEAttach ("Google.es ofrecido", "text")
;Msgbox (0, "K", $oIE)
;$oIE = _IEAttach ("Google", "embedded")
;Msgbox (0, "K", $oIE)
;$oIE = _IEAttach ("[REGEXPTITLE:Google; INSTANCE:2]", "embedded", 3)
;Msgbox (0, "K", $oIE)

;Code to search in google
$oForm = _IEFormGetObjByName($oIE, "f")
$oQuery = _IEFormElementGetObjByName($oForm, "q")

_IEFormElementSetValue($oQuery, "autoit")
_IEFormSubmit($oForm)
_IELoadWait($oIE)

;I generate a file with all the tag elements to see If I can see the google page code

$file = FileOpen("c:\kk.txt", 1)
$oElements = _IETagNameAllGetCollection ($oIE)
For $oElement In $oElements
    $oElementss = _IETagNameAllGetCollection ($oElement)
    For $oElementt In $oElementss
        $res = _IEPropertyGet($oElementt, "outerhtml")
        FileWriteLine($file, $res)
    Next
Next
FileClose($file)

Investigating the javascript code I guess that what they do is to play with the window javascript objet to have funny "popups". The problem is that my javascript level is not enough to understand exactly what is doing this javascript code.

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...