Jump to content

How to retrieve the link location using AutoIT?


Recommended Posts

Please see following image, there is an error as shown below

Do you have any suggestions on what is the possible cause for this IE's error?
Thanks, to everyone very much for any suggestions (^v^)

Click_Link7.png

Edited by oemript
Link to comment
Share on other sites

Status bar is "ON", error is removed, but session cannot be triggered by "focus".

Please see following image

Click_Link8.png

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

Edited by oemript
Link to comment
Share on other sites

Buggered if I know why it doesn't work on your system, it works fine for me, here is my last attempt:

#include <IE.au3>

Local $oIE = _IECreate("https://www.lazada.com.my/catalog/?q=toys")
WinSetState(_IEPropertyGet($oIE, "title"), "", @SW_MAXIMIZE)
Local $oListBoxs = _IETagNameGetCollection($oIE, "div")
Local $bListItems = False, $sSearch = "", $sLocationUrl = ""
For $oListBox In $oListBoxs
    If StringInStr($oListBox.ClassName, "ant-select-selection") Then
        _IEAction($oListBox, "click")
        ControlSend(_IEPropertyGet($oIE, "title"), "", "", "{TAB 2}")
        $bListItems = True
    EndIf
    If $bListItems Then
        If $oListBox.getAttribute("data-qa-locator") ="general-products" Then
            $oListItems = _IETagNameGetCollection($oListBox, "a")
            For $oListItem In $oListItems
                If StringStripWS($oListItem.InnerText, 8) <> "" Then
                    _IEAction($oListItem, "focus")
                    ConsoleWrite("Item Information: " & @CRLF & $oListItem.InnerText & @CRLF & @CRLF & "Item Address: " & @CRLF & _IEPropertyGet($oIE, "statustext") & @CRLF)
                EndIf
            Next
        EndIf
    EndIf
Next

 

Link to comment
Share on other sites

Yes, it works,

I am deeply appreciated for all your help

Thanks, to everyone very much for suggestions (^v^)

 

 

#include <IE.au3>

Local $oIE = _IECreate("https://www.lazada.com.my/catalog/?q=toys")
WinSetState(_IEPropertyGet($oIE, "title"), "", @SW_MAXIMIZE)
Local $oListBoxs = _IETagNameGetCollection($oIE, "div")
Local $bListItems = False, $sSearch = "", $sLocationUrl = ""
For $oListBox In $oListBoxs
    If StringInStr($oListBox.ClassName, "ant-select-selection") Then
        _IEAction($oListBox, "click")
        ControlSend(_IEPropertyGet($oIE, "title"), "", "", "{TAB 2}")
        $bListItems = True
    EndIf
    If $bListItems Then
        If $oListBox.getAttribute("data-qa-locator") ="general-products" Then
            $oListItems = _IETagNameGetCollection($oListBox, "a")
            For $oListItem In $oListItems
                If StringStripWS($oListItem.InnerText, 8) <> "" Then
                    _IEAction($oListItem, "focus")
                    ConsoleWrite("Item Information: " & @CRLF & $oListItem.InnerText & @CRLF & @CRLF & "Item Address: " & @CRLF & _IEPropertyGet($oIE, "statustext") & @CRLF)
                EndIf
            Next
        EndIf
    EndIf
Next

 

Link to comment
Share on other sites

Referring to following coding, I would like to know on how to retrieve URL from meta within View Page Sources, which name="og:url".

#include <IE.au3>
#include <Array.au3>
#include <String.au3>
#include <File.au3>
Local $oIE = _IECreate("https://www.lazada.com.my/products/sokano-mini-kitchen-fun-playset-with-full-utensils-set-pink-i100636698-s100895345.html")
WinSetState(_IEPropertyGet($oIE, "title"), "", @SW_MAXIMIZE)
Local $oListBoxs = _IETagNameGetCollection($oIE, "meta")
Local $bListItems = False, $sSearch = "", $sLocationUrl = ""
Sleep(2000)
For $oListBox In $oListBoxs
    If $bListItems Then
        If $oListBox.getAttribute("name") ="og:url" Then
            $oListItems = _IETagNameGetCollection($oListBox, "meta")
            For $oListItem In $oListItems
                If StringStripWS($oListItem.InnerText, 8) <> "" Then
                    _IEAction($oListItem, "focus")
                     ; How to retrieve URL from meta from View Page Sources, which name="og:url" ?
                    Exitloop 2
                 EndIf
            Next
         EndIf
      EndIf
 Next
_IEQuit($oIE)

 

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

meta.png

meta.png

Edited by oemript
Link to comment
Share on other sites

Please see following image, when I execute file first time without any problem, but when I execute file second time after IE closed, it pops up error message " Variable must be of type "Object"

#include <IE.au3>
#include <Array.au3>
#include <String.au3>
#include <File.au3>
Local Const $sFilePath = "D:\Link.txt"
Local $hFileOpen = FileOpen($sFilePath, $FO_READ)
Local $sFileRead = FileReadLine($hFileOpen, 1)
FileClose($hFileOpen)
;MsgBox($MB_SYSTEMMODAL, "", "First line of the file:" & @CRLF & $sFileRead)
Local $oIE = _IECreate($sFileRead)
$oMeta = _IEGetObjByName($oIE, 'og:url')
;ConsoleWrite($oMeta.GetAttribute('content') & @CRLF)
;MsgBox(0, "URL", StringReplace( $oMeta.GetAttribute('content') & @CRLF, "html/","html"))
Local $hFileOpen = FileOpen("D:\Import.txt", 2)
FileWrite($hFileOpen, StringReplace( $oMeta.GetAttribute('content') & @CRLF, "html/","html"))
FileClose($hFileOpen)
_IEQuit($oIE)

Do you have any suggestions on what wrong it is?
Thanks, to everyone very much for any suggestions (^v^)

Link.png

Edited by oemript
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...