yls12332 Posted June 2, 2011 Posted June 2, 2011 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 Could anybody give me any advice,many thanks!
smartee Posted June 2, 2011 Posted June 2, 2011 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
yls12332 Posted June 2, 2011 Author Posted June 2, 2011 (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. 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 June 2, 2011 by yls12332
smartee Posted June 2, 2011 Posted June 2, 2011 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
yls12332 Posted June 2, 2011 Author Posted June 2, 2011 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... 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
smartee Posted June 2, 2011 Posted June 2, 2011 (edited) yls12332, Very odd indeed, try this #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 June 2, 2011 by smartee
yls12332 Posted June 2, 2011 Author Posted June 2, 2011 (edited) Thanks,smartee! I found a result that IE8 works,but no IE9. 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 #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 June 2, 2011 by yls12332
yls12332 Posted June 2, 2011 Author Posted June 2, 2011 Finally,I got this article and solve the problemEnable Compatibility View for all websites in Internet ExplorerAdd the website into compatible list. Now,it works in IE9.Thanks again,smartee! Thanks,smartee! I found a result that IE8 works,but no IE9. I try another pc with IE8 browser and it works.Try finding if IE9's configuration can solve this issue.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now