Jump to content

Find a link in the site and navigate it?


Recommended Posts

hey i was making a bot for an site called Yarold and then you must click on links

but on the links you click appear in a popup window and that window has to be open for 20 seconds ( dont ask me why because when you have cliked the player has his click.. )

but anyway i was trying to run the program more then 1x on the same time and the popups

of the screens always stay at 1 new screen sow i cant run it more then 1 time because it doesnt wait anymore for 20 seconds but in 13 seconds the screen is refreshed

this is my code

#include <IE2.au3>
#include <IECompat.au3>

        ; load settings from Acc1

$HomeSiteName = IniRead("Settings.ini", "SiteRef", "HomeSiteName", "NotFound")
$KlikSiteName = IniRead("Settings.ini", "SiteRef", "KlikSiteName", "NotFound")
    
$Login = IniRead("Settings.ini", "Login", "Login", "NotFound")
$Pass = IniRead("Settings.ini", "Login", "Pass", "NotFound")

$Visible = IniRead("Settings.ini", "More", "Visible", "NotFound")
$TrayIconHide = IniRead("Settings.ini", "More", "TrayIconHide", "0")

Opt("TrayIconHide", $TrayIconHide)

        ;start navigating

$_oIE = _IECreate($Visible)
_IENavigate($_oIE,$HomeSiteName)

        ;log in

$_form = _IEFormGetObjByIndex($_oIE,1)
$_name = _IEFormElementGetObjByName($_form,"name")
_IEFormElementSetValue($_name,$Login)

$_pass = _IEFormElementGetObjByName($_form,"pass")
_IEFormElementSetValue($_pass,$Pass)

_IEFormSubmit($_form)

        ;move to member aandelen beurs and buy them loop 5 x 10 = 50 times

_IENavigate($_oIE,$KlikSiteName)

$i=200

While 1

_IELinkClickByIndex ($_oIE,$i)

If @error Then 
    $i = 21
    _IENavigate($_oIE,$KlikSiteName)

Else

Sleep(20000)
$test = _IENavigate($_oIE,$KlikSiteName)
$i = $i+1


EndIf

WEnd

the _IELinkClickByIndex ($_oIE,$i) take care of a popup but when you run the program more times all the popups come in the same screen

i was asking if anyone knuw a way to always open this link in a new screen (and that i can shut it down again) or a way to let the program find the link in the body and then navigate it in a self created IE window by using IEnavigate (because you can copy the link and put that in an other brouwer)

i hope somone understands me :">

cheers

Matthy

Link to comment
Share on other sites

Take a look at _IELinkGetCollection -- the example shows you how to get all links and then loop through them examining the href property. You can also use the .innerText property to see what the link text is and you can set the .target property to to something like "_blank" to force it to open in a new window.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Take a look at _IELinkGetCollection -- the example shows you how to get all links and then loop through them examining the href property. You can also use the .innerText property to see what the link text is and you can set the .target property to to something like "_blank" to force it to open in a new window.

Dale

Thaaanx dude your my hero :shocked: it now looks like this and that was exactyaly what i wanted :(

_IENavigate($_oIE,$KlikSiteName)

$Count = 21

While 1

_IENavigate($_oIE,$KlikSiteName)

for $i = 1 to 20

$oLinks = _IELinkGetCollection ($_oIE,$Count)
$iNumLinks = @extended

    _IENavigate($_oIE2,$oLinks.href)

$Count = $Count + 1

Sleep(2000)

Next

Your the best

Cheers

Matthy

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...