Sign in to follow this  
Followers 0
yls12332

_IEImgClick problem

8 posts in this topic

Hi all,

I got a problem with belog webpage using _IEImgClick().

webpage : http://htiis.myftp.org/link.cgi?sr=abc

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<link rel="icon" href="favicon.ico" type="image/ico" />

<link rel="SHORTCUT ICON" href="favicon.ico" type="image/ico" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link href="index.css" rel="stylesheet" type="text/css" />

<title>htiis資源館</title>

</head>

<body>

<div id="index">

<a href="link.cgi?sub=abc"><img src="image/index.gif" width="350" height="162" border="0" alt="SR資源館" /></a>

</div>

<div id="logo">

<a href="http://www.microsoft.com/taiwan/windows/ie/" target="_blank"><img src="image/ie.gif" width="15" height="15" border="0" alt="" title="Internet Explorer" /></a>

<a href="http://moztw.org/" target="_blank"><img src="image/firefox.gif" width="15" height="15" border="0" alt="" title="Mozilla Firefox" /></a>

<a href="http://www.w3.org/" target="_blank"><img src="image/w3c_xhtml.gif" width="80" height="15" border="0" alt="" title="W3C XHTML" /></a>

<a href="http://jigsaw.w3.org/" target="_blank"><img src="image/w3c_css.gif" width="80" height="15" border="0" alt="" title="W3C CSS" /></a>

<img src="image/sr.gif" width="80" height="15" border="0" alt="" title="SR-webs.com" class="sr" />

</div>

</body>

</html>

script code:

#include <IE.au3>

$oIE = _IECreate("http://htiis.myftp.org/link.cgi?sr=abc")
$rt = _IEImgClick($oIE,"image/index.gif","src")
If $rt = -1 Then
    MsgBox(0,"Info","image click ok,@error = " & @error)
Else
    MsgBox(0,"Info","image click not ok,@error = " & @error)
EndIf

i got a return code $rt = 1 and with no error,@error=0

i also try _IEImgGetCollection to loop all imgs,but same result at last :huh2:

Could anybody give me any advice,many thanks!

Share this post


Link to post
Share on other sites



hi,

This works fine for me:

#include <IE.au3>
$oIE = _IECreate("http://htiis.myftp.org/link.cgi?sr=abc")
_IEImgClick($oIE, "image/index.gif")

-smartee

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

hi, smartee

If it works,then the webpage will be redirected to http://htiis.myftp.org/main.cgi

Is that right for you?

My environment:

Win7

IE9

au3:v3.3.6.1

How about you?

Thanks for your qucikly reply. :huh2:

This works fine for me:

#include <IE.au3>
$oIE = _IECreate("http://htiis.myftp.org/link.cgi?sr=abc")
_IEImgClick($oIE, "image/index.gif")

-smartee

Edited by yls12332

Share this post


Link to post
Share on other sites

Yup, I got redirected to http://htiis.myftp.org/main.cgi, have you tried the code i used?

Working on Win7,IE 8, AutoIt 3.3.6.1

Share this post


Link to post
Share on other sites

Yes,

I revised my code as you provided,but unfortunately i can not redirect to that image link address.

It seems that program get the right image element(return code = -1),but with no any action on my webpage.

The page is a very simple html code,that's really strange... :huh2:

ps.i do reboot my computer,but the same result...

Yup, I got redirected to http://htiis.myftp.org/main.cgi, have you tried the code i used?

Working on Win7,IE 8, AutoIt 3.3.6.1

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

yls12332,

Very odd indeed, try this :huh2:

#include <IE.au3>
$oIE = _IECreate("http://htiis.myftp.org/link.cgi?sr=abc")
$oImgs = _IEImgGetCollection($oIE)
For $oImg In $oImgs
    $iResp = MsgBox(67, @ScriptName, "Click on " & $oImg.src & "?")
    Switch $iResp
        Case 6
            _IEImgClick($oIE, $oImg.src)
            ExitLoop
        Case 2
            ExitLoop
    EndSwitch
Next
_IEQuit($oIE)

-smartee

EDIT: Added ExitLoop after _IEImgClick()

Edited by smartee

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Thanks,smartee! ;)

I found a result that IE8 works,but no IE9. :huh2:

I try another pc with IE8 browser and it works.

Try finding if IE9's configuration can solve this issue.

yls12332,

Very odd indeed, try this :alien:

#include <IE.au3>
$oIE = _IECreate("http://htiis.myftp.org/link.cgi?sr=abc")
$oImgs = _IEImgGetCollection($oIE)
For $oImg In $oImgs
    $iResp = MsgBox(67, @ScriptName, "Click on " & $oImg.src & "?")
    Switch $iResp
        Case 6
            _IEImgClick($oIE, $oImg.src)
            ExitLoop
        Case 2
            ExitLoop
    EndSwitch
Next
_IEQuit($oIE)

-smartee

EDIT: Added ExitLoop after _IEImgClick()

Edited by yls12332

Share this post


Link to post
Share on other sites

Finally,I got this article and solve the problem

Enable Compatibility View for all websites in Internet Explorer

Add the website into compatible list.

Now,it works in IE9.

Thanks again,smartee! ;)

Thanks,smartee! :alien:

I found a result that IE8 works,but no IE9. :huh2:

I try another pc with IE8 browser and it works.

Try finding if IE9's configuration can solve this issue.

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  
Followers 0