Jump to content

Tabed Borwsing


Recommended Posts

I have writen a program that switches between tabs this works ok but i am having trouble with the tab when i try to click a control in the second tab it always seems to send the click to the original tab and not any other tabs that i create.

I am fairly new to autoit but i am getting there

#include <IE.au3>
#include <string.au3>
AutoItSetOption ("RunErrorsFatal", 0)
$oIE = _IECreate()

HotKeySet ("{ESC}", "MyExit")
AutoItSetOption ( "WinTextMatchMode", 2 )

;                   open tabs and go to recruiter
opentabs()
firstrecbut()
recruit ()


Func MyExit ()
    Exit
EndFunc



Func recruit ()
    
    $oImg = _IEImgGetCollection ($oIE, 2)

    $z = 0
    Do
        _IEImgClick ($oIE, "A.gif?1183931061", "src",2)
        Send ("{CTRLDOWN}")
        Send ("{TAB}")
        Send ("{CTRLUP}")
        _IEImgClick ($oIE, "A.gif?1183931061", "src",2)
        Send ("{CTRLDOWN}")
        Send ("{TAB}")
        Send ("{CTRLUP}")
        sleep(1000)
        
        $z = $Z + 1
    Until $z > 350


EndFunc

Func status()
    autoItSetOption("WinTitleMatchMode", 2)
    $x = StatusbarGetText("Internet Explorer")
    While $x = "wait"
        $x = StatusbarGetText("Internet Explorer")
    WEnd
EndFunc

Func opentabs()
_IENavigate($oIE, "http://silver.darkthrone.com/recruiter")
sleep(2000)
Send ("{CTRLDOWN}")
Send ("{t}")
Send ("{CTRLUP}")
_IENavigate($oIE, "http://silver.darkthrone.com/recruiter")
Sleep(2000)
endfunc

Func firstrecbut()
$oImg = _IEImgGetCollection ($oIE, 2)
_IEImgClick ($oIE, "A.gif?1183931061", "src",2)
        Send ("{CTRLDOWN}")
        Send ("{TAB}")
        Send ("{CTRLUP}")
sleep(2000)
$oImg = _IEImgGetCollection ($oIE, 2)       
_IEImgClick ($oIE, "A.gif?1183931061", "src",2)
Sleep(5000)

EndFunc
Link to comment
Share on other sites

You approach could work, although it is not the way I would do it. I would use _IEAttach embedded to get the individual tabbed instances once they are created (which, unfortunately is broken in 3.2.10.0 and should be fixed inthe next beta release :-( )

You can also make use of an undocumented __IENavigate function that allows you to do more work with tabs (search the forum for it or look at the source of IE.au3).

One thing I had to do in your code was to put in another sleep after you switched tabs to give it a chance to change before trying to do anything with the bew browser instance in the other tab.

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

  • 4 months later...

Fixed in 3.2.12.x

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

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