Jump to content

Click on button with classname failured

Recommended Posts


Hello guys, I created script which must click on object with classname on website and after it, copy phrase between two tags (I used IE.au3). Scripts work but not always. Sometime script loading page and when page is already load script dont click on object. Before it script dont crash itself. I dont know what is wrong :/ Please help me guys

#include <Constants.au3>
#include <IE.au3>
#include <String.au3>
#include <Array.au3>
Opt("TrayIconDebug", 1)
HotKeySet("{F9}", "kill")
HotKeySet("{F10}", "pause")
$zero = Null
Func kill()
   Exit 0

Func pause()
    $Paused = NOT $Paused
    While $Paused
        Tooltip('Script is "Paused"',0,0)

Until $i<-1

Func nr()
$strona = FileReadLine("strony.txt",$i+1)
$file = fileopen(@scriptdir & "\source.txt", 10)
$IE = _IECreate($strona)
_IEAction($IE, "refresh")
_IEAction($IE, "stop")
$oInputs = _IETagNameGetCollection($IE, "span")

For $oInput In $oInputs
   If $oInput.classname = "icon inlblk vtop b_phone4" Then _IEAction($oInput, "focus")
   If $oInput.classname = "icon inlblk vtop b_phone4" Then _IEAction($oInput, "click")
   If $oInput.classname = "link spoiler small nowrap" Then _IEAction($oInput, "focus")
   If $oInput.classname = "link spoiler small nowrap" Then _IEAction($oInput, "click")
$source = _IEDocReadHTML($IE)
FileWrite($file, $source)
If (_StringBetween($source, '<strong class="xx-large">', '</strong>') <> 0) Then
$target_source = _StringBetween($source, '<strong class="xx-large">', '</strong>')
$numer = fileopen(@scriptdir & "\numer.txt", 1)
FileWrite($numer, $target_source[0])
FileWrite($numer, @CRLF)
;;$target_source = _StringBetween($source, '<strong class="xx-large">', '</strong>')


Share this post

Link to post
Share on other sites

When I refresh page manual script sometimes starts work fine, but after some time script hangs again. I think it is problem with status IE.

Share this post

Link to post
Share on other sites

I looked on try icon and script hangs on IE.au3, Line 483, Sleep(100). Anyone can help me?

Share this post

Link to post
Share on other sites

It could be because you are only giving it 1 milisecond to check the status and to load: 

$iDelay [optional] Milliseconds to wait before checking status
$iTimeout  [optional] Period of time to wait before exiting function (default = 300000 ms aka 5 min)

Try ditching those two optional parameters and using the defaults (or something larger).

Edit: and then to my earlier post I would remove that refresh because it will defeat the purpose of waiting (also not sure why you have "stop" ?)

Edited by Jfish

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

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


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.