selectWindow | tab=open | ... opens tab twice (double opens)

This might be related to this thread:

However, that thread appears to have never been resolved.

What kinds of situations would cause selectWindow to open a tab twice? Is it a timing issue that putting a pause before or after might fix? Or is there a waitfor or onEvent sort of command I can use as a remedy?

Or can someone lead me to a way in my script to detect how many tabs are open so that I can use selectWindow | tab=close to close the extra tab?


This is a old bug never solved.

Sometimes open 4-5 same tabs this command

Here my report

This is a random bug, and appears only with some version of browser.

I found a solution to bypass it

I added in my browser more pages like default pages and i use to switch in tabs and after i use only open command

My firefox run with 5 tabs opened with a site, after i run macro with this code

  "Name": "A",
  "CreationDate": "2019-10-31",
  "Commands": [
      "Command": "bringBrowserToForeground",
      "Target": "",
      "Value": ""
      "Command": "selectWindow",
      "Target": "tab=1",
      "Value": ""
      "Command": "open",
      "Target": "",
      "Value": ""

In this mode i have not multiple random tabs opened because i use tab already opened in firefox.

Here solution to start firefox with multiple tabs opened of default

There are not others solution.

This is good information for me, newuserkantu.

The problem I had with the Open command is sometimes the macro stops because of something like “no page load event”. And yet the pages loaded fine. I did overcome this Open command problem by setting !errorIgnore to false.

Thank you for inspiring and helping.

When use command open add wait 60000 (1 minutes) to give time to load the site, I usually give from 1 to 3 minutes of time to be sure that the site has been fully loaded.

You can combine with this command to waitforpagetoload (this usually detect correct time of loading of page) i combine waitforpagetoload and wait, if the first command waitforpagetoload fails the is second command wait to add a delay in open command.

The bug of multilple tab opened is selectWindow and open used in same command.

I’m glad you included the link. Clicking the link caused me to look at the waitForPageToLoad command a second time. I see that I missed an important detail that you can specify a wait time.

In my case, I see the page load. Then I see waitForPageToLoad timeout after the default timeout of 60 seconds. About three months ago, the website with which I am dealing with actually did need up to 3 or more minutes to load, and even then, the load would often stall out. That was before I had even heard of UI.Vision Kantu. That website has really pepped itself up. The pages are loading fast. I can see how the page could have 2 page load events before it is fully loaded because the source has iframes. I’m guessing that (as described in waitForPageToLoad) this website can have the 2 or more page load events too close together for Kantu to detect both every time.

What could be happening is: I issue the Open command. Then after 0.8 seconds (for instance), the server already responds. I get the first page load event which allows Kantu to go to the next command, waitForPageToLoad. If Kantu gets to waitForPageToLoad in time, then it detects the second page load event. Otherwise waitForPageLoad misses the second page load event and times out.

But anyway, doesn’t matter because my making use of the practical information you’re giving me has made my script much more solidly reliable.

If you detect an element loaded after the full loading of the page you can use this command

But you may attention to the frame, the frame are the hard part of selenium need more accuracy to detect.

waitForPageToLoad in my opinion do not work in all sites in some cases fails usually when there are script loaded from external site and iframe.

@Indinfer How are you starting the macro? I had the same issue but only when starting from the autorun HTML, which I believe is by design because you can’t start from a new tab page. I use selectWindow tab=0 and then open so you use the same newly opened tab.

With some browser version i have your same problem, now i use firefox ESR portable 60.9 and I have not any problem.

I run macro via batch file I use this trick

First I run borwser and wait 1 minute of delay (to wait totally load of firefox)

After 1 minute i run macro.

Batch file

:: 'Start Firefox'
    START /B "" "C:\Program\Firefox Portable ESR\FirefoxPortable.exe"

    ping -n 60 localhost >nul 2>&1

    :: 'Start Kantu'
    START /B "" "C:\Program\Firefox Portable ESR\FirefoxPortable.exe" "file:///C:\Program\Kantu\command_line\kantu_start.html?folder=automatic1&direct=1&storage=xfile&closeBrowser=0&closeKantu=1"

    ping -n 10 localhost >nul 2>&1


The double tab-opening was without starting from the autorun HTML. But what I am probably doing different that causes the double-tab opening is that I am opening the same URL many times.

Thank you, newuserkantu, my applying your hints has helped my scripts to work more solidly.

What type of firefox do you use ? (installed or portable)
What version of firefox do you use ?
What version of ui vision Kantu do you use ?

Currently I use firefox portable ESR 60.9 with Kantu 5.1.9 and this problem no longer arises, before I used firefox ESR portable 68 with kantu 5.1.9 and I had your same problem, I had to use an old version of firefox just because of the problem that it happens to you that did not allow me to work now it never happens that opens me 2 times the same firefox tab.

I think this problem may be an incompatible quantum engine of firefox because I noticed that some times if you manually click a link can open 2 tabs, also does not happen with all versions of firefox

I’m using installed Firefox 70.0.1 (64-bit),
Kantu 5.2.3. I don’t know where to check for a later version.

I have not noticed the double tabs. But now it is less likely that I would notice because I’m coding
selectWindow | tab=closeallother
in a few places. This works well enough for me so far.

I’m trying to download about 30 data files. The problem I’m having is sometimes a file is skipped and sometimes the same file is downloaded twice.

Possibilities I can think of:

  1. My code actually skips the files. I’ve been checking but have not yet found any files missing in my code. But maybe I will see it later.
  2. A timing problem. Maybe my code is hitting the website too fast. Before the website downloads one file, my code is already requesting the next file. I got some improvement by putting some pauses for 5000 ms.
  3. Maybe something is not getting cleared between files. I have one case in which a file is downloaded twice. First time is when it is supposed to download, and the second time is instead of the next file.

For now, the double tab openings are not concerning me.

I suppose I am wandering off the topic of this thread that I started. So, I started another thread with my current concern: