Jump to content

IE automation : tabs management


Recommended Posts

Hi,

I've got 2 issues :

1/ Elements not detected in a page when there are several tabs

Scenario :

Local $o_IE = _IECreate("www.url1.com", 0, 1, 0, 0)
Sleep(1000) ;I'm absolutely sure that this page has finished loading.
__IENavigate($o_IE, "www.url2.com", 0, 0x800) ;it's not the same function as _IENavigate   != __IENavigate
_IELoadWait($o_IE, 3000, 3000)
If StringInStr(_IEBodyReadText($o_IE), "expected text on page") = 0
    return $errorcode

The string "expected text on page" is not detected in "www.url2.com" when using __IENavigate (i.e. a new tab). That code works perfectly when I do the test with that simple code :

Local $o_IE = _IECreate("www.url2.com", 0, 1, 0, 0)
_IELoadWait($o_IE, 3000, 3000)
If StringInStr(_IEBodyReadText($o_IE), "expected text on page") = 0
    return $errorcode

2/ How to switch between tabs

I'm not sure how to handle the tabs independently after they've been created. The problem is that they're all designated by $o_IE. and I don't like to handle them by the potential title of the page in them (what if the page has changed? It's too inaccurate).

Is there any solution? for example, having each tab as an independant variable, just like we have handles when it comes to windows?

Link to comment
Share on other sites

Actually, the question here is different than the one posed in that post.

You can get a reference to the browser instance in the other tab with _IEAttach after the __IENavigate is complete.

Dale

Edited by DaleHohm

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