Jump to content
Sign in to follow this  
Glyph

Problem with _IEPropertyGet

Recommended Posts

Glyph

#include <IE.au3>
$oIE = _IECreate("http://reapercorps.org")
$links=2
$sMyString1 = "Admin Area"
$sMyString2 = "File uploads: "
$oLinks = _IELinkGetCollection($oIE)

do
For $oLink in $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $sMyString1) Then
        _IEAction($oLink, "click")
        $Links-=1
        ExitLoop
    EndIf
    
    If StringInStr($sLinkText, $sMyString2) Then
        _IEAction($oLink, "click")
        $Links-=1
        ExitLoop
    EndIf
    
Next
until $Links=0

It will click admin area, then error.

--> IE.au3 V2.4-0 Error from function _IEPropertyGet, $_IEStatus_InvalidObjectType

This logic seems right to me, but obviously it isn't...

tolle indicium

Share this post


Link to post
Share on other sites
Valuater

Suggestion....

#1 Add an error handler

$MyErrorHandler = _IEErrorHandlerRegister()

#2 I'm not sure of the "innertext" on a link... that may not be correct, I dunno, Maybe the text can be used like...

If StringInStr($oLink, $sMyString1) Then

It is possible that not all links have "innertext" and that errors, as it should, but ??

Just some thoughts here

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
PsaltyDS

#include <IE.au3>
$oIE = _IECreate("http://reapercorps.org")
$links=2
$sMyString1 = "Admin Area"
$sMyString2 = "File uploads: "
$oLinks = _IELinkGetCollection($oIE)

do
For $oLink in $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $sMyString1) Then
        _IEAction($oLink, "click")
        $Links-=1
        ExitLoop
    EndIf
    
    If StringInStr($sLinkText, $sMyString2) Then
        _IEAction($oLink, "click")
        $Links-=1
        ExitLoop
    EndIf
    
Next
until $Links=0

It will click admin area, then error.

This logic seems right to me, but obviously it isn't...

Once you click on one of the links and navigate away, the objects in the collection are no longer valid. So it should work the first time through, then fail on the second pass.

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.