Jump to content
oemript

Can AutoIT scripts invoke to retrieve the session?

Recommended Posts

oemript

Referring to following link and image, I would like to know on what kind of scripts can invoke to retrieve the session:

Before clicking, session does not add into URL yet, but

Once after clicking anywhere within web page, session is added into URL as shown below.

Is there AutoIT function able to trigger any AJAX to show the URL + session? and retrieve the URL + session into text file?

Does anyone have any suggestions?
Thanks in advance for any suggestions

Ref : https://world.taobao.com/

URL.png

Share this post


Link to post
Share on other sites
Subz

Maybe something like (you'll need to add the URL you want to test.)

#include <Array.au3>
#include <IE.au3>

Local $oIE = _IECreate("https://www.taobao.com/markets/tbhome/yhh-detail...", 1)
_IELoadWait($oIE)
MsgBox(0,'', "Site address: " & $oIE.Document.Location.Origin & @CRLF & "Path name: " & $oIE.Document.Location.PathName)
$aURL = StringSplit(StringReplace($oIE.Document.Location.Search, "?", ""), "&")
_ArrayDisplay($aURL)

 

Share this post


Link to post
Share on other sites
oemript
2 hours ago, Subz said:

 

#include <Array.au3>
#include <IE.au3>

Local $oIE = _IECreate("https://www.taobao.com/markets/tbhome/yhh-detail...", 1)
_IELoadWait($oIE)
MsgBox(0,'', "Site address: " & $oIE.Document.Location.Origin & @CRLF & "Path name: " & $oIE.Document.Location.PathName)
$aURL = StringSplit(StringReplace($oIE.Document.Location.Search, "?", ""), "&")
_ArrayDisplay($aURL)

 

I would like to know on whether above coding need to run under AutoIT or not, does it have any online AutoIT platform for testing without any installation?

Do you have any suggestions?

Thank you very much for any suggestions (^v^)

 

Edited by oemript

Share this post


Link to post
Share on other sites
Subz

Just compile the code as exe and then you can run it on any system.

Share this post


Link to post
Share on other sites
oemript

When I insert the direct link into following code, there is no session added into URL, please see attached image

The session would only be created and add into the URL link after a clicking action on home page.

Ref : https://world.taobao.com/

Do you have any suggestions on how to trigger a click to simulate an Ajax web session?
Thank you very much for any suggestions (^v^)

 

#include <Array.au3>
#include <IE.au3>

Local $oIE = _IECreate("https://detail.tmall.hk/hk/item.htm?id=562971448286", 1)
_IELoadWait($oIE)
MsgBox(0,'', "Site address: " & $oIE.Document.Location.Origin & @CRLF & "Path name: " & $oIE.Document.Location.PathName)
$aURL = StringSplit(StringReplace($oIE.Document.Location.Search, "?", ""), "&")
_ArrayDisplay($aURL)

URL2.png

Edited by oemript

Share this post


Link to post
Share on other sites
Subz

Look at the _IEAction function in the help file, you can then click an item using the "click" action.

Share this post


Link to post
Share on other sites
oemript

Please see the attached image, an error is occurred on line 5312.

Do you have any suggestions on what wrong it is?
Thank you very much for any suggestions (^v^)

 

Taobao1.png

Edited by oemript

Share this post


Link to post
Share on other sites
Subz

You can use something like:

#include <Array.au3>
#include <IE.au3>

Local $sHomePath = "https://world.taobao.com/"
Local $sMarketPath = "https://www.taobao.com/markets/tbhome/yhh-detail"
Local $oIE = _IECreate($sHomePath, 1)
_IELoadWait($oIE)
Sleep(3000)
Local $oLinks = _IELinkGetCollection($oIE)
For $oLink In $oLinks
    If StringInStr($oLink.href, $sMarketPath) Then
        _IENavigate($oIE, $oLink.href)
        ExitLoop
    EndIf
Next
_IELoadWait($oIE)
MsgBox(0,'', "Site address: " & $oIE.Document.Location.Origin & @CRLF & "Path name: " & $oIE.Document.Location.PathName)
$aURL = StringSplit(StringReplace($oIE.Document.Location.Search, "?", ""), "&")
_ArrayDisplay($aURL)

 

Share this post


Link to post
Share on other sites
oemript

Referring to following coding, I try to understand some highlighted issues as shown below.

Furthermore, when I click and hold any image and drag to another place and release it, which do not do anything, but this action would trigger Javascripts / AJAX to add session on each URLs.  Do you have any idea on how to trigger similar action on web page?

Do you have any suggestions?
Thanks, to everyone very much for any suggestions (^v^)

================================================================================================

#include <Array.au3>
#include <IE.au3>

Local $sHomePath = "https://world.taobao.com/"
Local $sMarketPath = "https://www.taobao.com/markets/tbhome/yhh-detail"
Local $oIE = _IECreate($sHomePath, 1)
_IELoadWait($oIE)
Sleep(3000)
Local $oLinks = _IELinkGetCollection($oIE),

Return Value : an object collection of all links in the document, @extended = link count?
Does it return a list of links within $oIE?

For $oLink In $oLinks
    If StringInStr($oLink.href, $sMarketPath) Then
        _IENavigate($oIE, $oLink.href)

Description : Directs an existing browser window to navigate to the specified URL

What do _IENavigate do here? does it trigger any Javascript / AJAX on web page?

        ExitLoop
    EndIf
Next
_IELoadWait($oIE)
MsgBox(0,'', "Site address: " & $oIE.Document.Location.Origin & @CRLF & "Path name: " & $oIE.Document.Location.PathName)
$aURL = StringSplit(StringReplace($oIE.Document.Location.Search, "?", ""), "&")
_ArrayDisplay($aURL)

Edited by oemript

Share this post


Link to post
Share on other sites
Subz

Didn't realise there were multiple urls try the following:

#include <Array.au3>
#include <IE.au3>

Local $sHomePath = "https://world.taobao.com/"
Local $oIE = _IECreate($sHomePath, 1)
_IELoadWait($oIE)
Sleep(3000)
Local $oLinks = _IETagNameGetCollection($oIE, "a")
For $oLink In $oLinks
    If $oLink.ClassName = "item-con" Then
        _IEAction($oLink, "Focus")
        $sStatusMsg = $oIE.StatusText
        ExitLoop
    EndIf
Next
$sHomeAddress = StringLeft($sStatusMsg, StringInStr($sStatusMsg, "?") -1)
$sSiteParams = StringReplace($sStatusMsg, $sHomeAddress & "?", "")
$aSiteParams = StringSplit($sSiteParams, "&")
MsgBox(0, "", "Site Address: " & $sHomeAddress & @CRLF & "Site Params: " & $sSiteParams)
_ArrayDisplay($aSiteParams)

 

Share this post


Link to post
Share on other sites
oemript

Referring to following coding, I try to understand some highlighted issues as shown below.

Please see below image for error message

Taobao2.png

Do you have any suggestions?
Thanks, to everyone very much for any suggestions (^v^)

===========================================================================================

#include <Array.au3>
#include <IE.au3>

Local $sHomePath = "https://world.taobao.com/"
Local $oIE = _IECreate($sHomePath, 1)
_IELoadWait($oIE)
Sleep(3000)
Local $oLinks = _IETagNameGetCollection($oIE, "a")
For $oLink In $oLinks
    If $oLink.ClassName = "item-con" Then
        _IEAction($oLink, "Focus")

Description : Causes the element to receive focus.

I would like to know on what receiving focus do, does it trigger any Javascripts / AJAX on web page?
        $sStatusMsg = $oIE.StatusText

I cannot find any reference for .StatusText, could you please describe more on what statusText do under AutoIT?
        ExitLoop
    EndIf
Next
$sHomeAddress = StringLeft($sStatusMsg, StringInStr($sStatusMsg, "?") -1)
$sSiteParams = StringReplace($sStatusMsg, $sHomeAddress & "?", "")
$aSiteParams = StringSplit($sSiteParams, "&")
MsgBox(0, "", "Site Address: " & $sHomeAddress & @CRLF & "Site Params: " & $sSiteParams)
_ArrayDisplay($aSiteParams)

 

Edited by oemript

Share this post


Link to post
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

×