V5.3.7 closeBrowser=1 not working

Hi @TechSupport ,

I’m using Google Chrome Portable and have 2 profiles. One of them is still on v5.2.3 and the other one has updated to v5.3.7

It seems that closeBrowser=1 has stopped working on v5.3.7

I have a batch file that closes Chrome on v5.2.3. But on v5.3.7, both UI.Vision and the Browser remains open. I tried adding closeKantu=1 but it didn’t make a difference.

C:\chrome\GoogleChromePortable.exe "file:///C:/temp/SimpleTest.html?direct=1&closeBrowser=1"

Could you try out on your end?

Hi, I tested with V5.3.7 and closeBrowser=1works fine.

Youtube Screencast of the test:

Hi @TechSupport. Thanks for testing. Much appreciated.

I have both v5.2.3 and v5.3.7 running. Using the same code. v5.2.3 will close the browser. v5.3.7 doesn’t anymore. Not sure how a screencast can help but I can create one if needed.

I have a simple batch file:

set var_Browser=C:\chrome\GoogleChromePortable.exe --profile-directory="Profile 1"
start "" %var_Browser% "file:///C:/temp/TestUIVision.html?direct=1&closeKantu=1&closeBrowser=1"

Profile 1 has v5.2.3 and closes the browser. I have the same as above with Profile 2 and v5.3.7 and both UI.Vision and the Browser stays open after completion. Possible that something in v5.3.7 blocks the close in our work environment. I will try to test at home as well.

Both Profile 1 and Profile 2 have been running every 20 minutes 12 hours a day for the last several months. Generally ran smoothly. When Profile 2 auto-updated to v5.3.7, the browser now stays open. So I’ll have to think of a workaround like killing the Chrome task after a period of time. Not ideal, but the only workaround I can think off.

Just want to let you know though that in my work environment, v5.2.3 still works fine but v5.3.7 doesn’t.

And if you just enter the “URL” in the browser, do you see the same?

file:///C:/yourpath/yourmacro.html?direct=1&closeKantu=1&closeBrowser=1

=> works for me in FX and CR.

Hi @admin. I tried this:

file:///C:/temp/TestUIVision.html?direct=1&closeKantu=1&closeBrowser=1

v5.2.3 - Opens Kantu, runs the script, closes Kantu, closes Chrome
v5.3.8 - Opens Kantu, runs the script, Kantu stays open (effectively Chrome stays open)

The above tests for v5.2.3 and v5.3.8 are on the same PC, the same Chrome browser.

v5.3.7 (Firefox) - Opens Kantu, runs the script, Kantu stays open (effectively Firefox stays open)

I will try again at home and see if the environment will have an impact.

Hi @admin. Just an FYI. I tried this on my home desktop (no restrictions whatsoever, unlike office environment). All I do is paste this URL on the browser:

file:///C:/temp/TestUIVision.html?direct=1&closeKantu=1&closeBrowser=1

Exactly the same problem as described above. v5.2.3 will close Kantu/Browser (expected behaviour). v5.3.8 will leave Kantu/Browser open.

It would be great if someone else can test this (@ulrich, would you be able to test?). It shouldn’t matter what macro you run but here’s the content of TestUIVision macro:

{
  "Name": "TestUIVision",
  "CreationDate": "2019-12-11",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://www.google.com/",
      "Value": ""
    },
    {
      "Command": "clickAndWait",
      "Target": "xpath=//*[@id=\"tsf\"]/div[2]/div[1]/div[3]/center/input[2]",
      "Value": ""
    }
  ]
} 

And here’s the HTML for completeness

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>TestUIVision</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">TestUIVision</td></tr>
</thead><tbody>

      <tr>
        <td>open</td>
        <td>https://www.google.com/</td>
        <td></td>
      </tr>
    

      <tr>
        <td>clickAndWait</td>
        <td>xpath=//*[@id="tsf"]/div[2]/div[1]/div[3]/center/input[2]</td>
        <td></td>
      </tr>
    
</tbody></table>
<script>
(function() {
  var isExtensionLoaded = function () {
    const $root = document.documentElement
    return !!$root && !!$root.getAttribute('data-kantu')
  }
  var increaseCountInUrl = function (max) {
    var url   = new URL(window.location.href)
    var count = 1 + (url.searchParams.get('reload') || 0)

    url.searchParams.set('reload', count)
    var nextUrl = url.toString()

    var shouldStop = count > max
    return [shouldStop, !shouldStop ? nextUrl : null]
  }
  var run = function () {
    try {
      var evt = new CustomEvent('kantuSaveAndRunMacro', { detail: { html: document.documentElement.outerHTML, storageMode: 'browser' } })

      window.dispatchEvent(evt)
      setInterval(() => window.dispatchEvent(evt), 1000);

      if (window.location.protocol === 'file:') {
        var onInvokeSuccess = function () {
          clearTimeout(timer)
          clearTimeout(reloadTimer)
          window.removeEventListener('kantuInvokeSuccess', onInvokeSuccess)
        }
        var timer = setTimeout(function () {
          alert('Error #203: It seems you need to turn on *Allow access to file URLs* for Kantu in your browser extension settings.')
        }, 8000)

        window.addEventListener('kantuInvokeSuccess', onInvokeSuccess)
      }
    } catch (e) {
      alert('Kantu Bookmarklet error: ' + e.toString());
    }
  }
  var reloadTimer = null
  var main = function () {
    if (isExtensionLoaded())  return run()

    var MAX_TRY   = 3
    var INTERVAL  = 1000
    var tuple     = increaseCountInUrl(MAX_TRY)

    if (tuple[0]) {
      return alert('Error #204: It seems UI.Vision RPA is not installed yet - or you need to turn on *Allow access to file URLs* for UI.Vision RPA in your browser extension settings.')
    } else {
      reloadTimer = setTimeout(function () {
        window.location.href = tuple[1]
      }, INTERVAL)
    }
  }

  main()
})();
</script>
</body>
</html>

Same problem for me.
Using Firefox 71.0 and Kandu 5.3.7
Neither Kantu or browser tab/window is closed.

A question for both of you: Is it the same in Firefox and Chrome?

Hi @admin. Same issue on both. And I tried in 2 different environments already (at work and at home)

UI.Vision and Chrome/Firefox stay open:

  • Chrome Version 79.0.3945.79 (64-bit), UI.Vision RPA v5.3.8
  • Firefox Version 71.0 (64-bit), UI.Vision RPA v5.3.7

Behaves correctly

  • Chrome Version 79.0.3945.79 (64-bit), UI.Vision RPA v5.2.3

Note that I have the same Chrome version on the same PC running both v5.3.8 and v5.2.3 side-by-side. With v5.3.8, UI.Vision and browser remain open. With v5.2.3, works as expected (browser opens, UI.Vision runs. After completion, UI.Vision closes, browser closes)

The issue is fixed in V5.3.10 - thanks again for reporting it!

1 Like

Thanks @admin. I just downloaded v5.3.10 on Chrome and closeBrowser=1 is working again as expected.