Please fix Error: No Connection to browser tab

I use powershell with command "taskkill /F /IM chrome.exe /T " to kill all chrome tabs and then start ui vision, Chrome Pop up with “Restore Pages” message, then it is failed to run ui vision as Error # 180: No Connection to browser tab appear. There is no such problem when i use version 6.2.8.

image

Hi, we are aware of this issue but it is very hard to recreate.

Do you have a way to trigger this error reliably?

PS: Also, please retest with V8.0.1 - some changes have been made.

Hi, same error. Running v8.01
I also use powershell to trigger, and use taskkill.
I tried to see if the problem was in chrome and its “restore pages” popup. It worked for a couple of days and then the same result with error 180 after trying this fix:
** Navigate to the following path: C:\Users<username>\AppData\Local\Google\Chrome\User Data\Default*
** Search Preferences file*
** Open file with notepad*
** Search the value “exit_type”:“Crashed” and change it to “exit_type”: “none”*
** Search “exited_cleanly” and it should be “exited_cleanly”:true*
** Save & Close the preferences file*
** Right-click on the file and make it read-only else chrome will update this file again with initial values.*

The fix removed the popup for restore pages but did not fix the problem.
When i get the error 180 message, it stops working until i fix it. To fix it, i can close the tab where the error 180 comes, start the powershell script again, it then says No tab with id …, then i close chrome. After that i can run the powershell script and the macro works.
When i still have the error 180 and trigger the macro manually with in chrome, they run ok. But not from the powershell script i trigger with task scheduler in windows (Win 10 21H2).
if i start tools for programmer and look for error this comes up:
ui.vision error 180
If i can help in any way then let my know. i get the error now and then.

1 Like

Thanks for these very helpful details!

What we would love to have is a way to reliably trigger the “180” error, then we could debug it. Now we have to run a test for days just to see the error once or twice.

Hi I get it regularly as well, do you have log files I could sent each time it happens?
in regards to the 180 I found that it happens in connection with a failed macro in hdd mode.

I use storage in browser and not on harddrive and still have the error 180 problem.
Yes i seem to get all the time now. My macros never finish the last couple of days. I have 13 marcros running in a row every hour. It now always fails on the same macro.
I can se if a can export my macros and script and remove some credentials and such.

Have you tried to reload the macros and run an empty macro?

{
  "Name": "OpenRPA",
  "CreationDate": "2022-8-30",
  "Commands": []
}

What is this supposed to do?

Ok. This might help.

To clarify: So from your 13 macros, “only” one fails with the 180 error?

I have the situation that after I had a 180 I get it each time after that until I reload the macro and run one that works… Else each time I try to run a macro via the api I get an 180… (that said, my case is with hdd…)

Therefore my suggestion…

I can replicate the error now.
If i create a macro, trigger it by my script, and if the macro takes longer then my time out in my powershell script, the script runs Taskkill /im chome.exe /F and starts next macro, then the 180 error comes.

Interesting I kill chrome after a failed macro as well…

Here is my macro

 {
  "Name": "Virkespriser",
  "CreationDate": "2022-8-30",
  "Commands": [
    {
      "Command": "store",
      "Target": "medium",
      "Value": "!replayspeed",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!errorIgnore",
      "Description": ""
    },
    {
      "Command": "bringBrowserToForeground",
      "Target": "",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "https://www.byggmax.se/45x95-kortregel-p08145096",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "30",
      "Value": "!TIMEOUT_WAIT",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=/html/body/div[4]/div/div/div/button",
      "Value": "",
      "Targets": [
        "xpath=/html/body/div[4]/div/div/div/button",
        "xpath=//div[4]/div/div/div/button",
        "css=body > div.amgdprcookie-bar-template > div > div > div > button.amgdprcookie-button.-allow"
      ],
      "Description": ""
    },
    {
      "Command": "if_v2",
      "Target": "${!STATUSOK}==true",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Byggmax - Butik ej vald, fortsätter.",
      "Value": "green",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "linkText=Välj din butik@POS=2",
      "Value": "",
      "Targets": [
        "linkText=Välj din butik@POS=2",
        "xpath=//*[@id=\"maincontent\"]/div/div/div[3]/div[2]/div/div[2]/div/a",
        "xpath=//div[2]/div/div[2]/div/a",
        "css=#maincontent > div > div > div.content-wrapper > div.product-info-actions-wrapper > div > div.add-to-button-message > div > a"
      ],
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "name=postal_code",
      "Value": "85751",
      "Targets": [
        "name=postal_code",
        "xpath=//*[@id=\"shop_selector\"]/input",
        "xpath=//input[@name='postal_code']",
        "xpath=//div[2]/form/input",
        "css=#shop_selector > input:nth-child(1)"
      ],
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=//*[@id=\"shop_selector\"]/div/button",
      "Value": "",
      "Targets": [
        "xpath=//*[@id=\"shop_selector\"]/div/button",
        "xpath=//div[2]/div/div/div[2]/form/div/button",
        "css=#shop_selector > div > button"
      ],
      "Description": ""
    },
    {
      "Command": "else",
      "Target": "",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Byggmax - Butik redan vald, fortsätter.",
      "Value": "green",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=//*[@id=\"product-price-74244\"]/span/span",
      "Value": "Virkespriser95x45",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "10",
      "Value": "!TIMEOUT_WAIT",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "https://www.byggmax.se/45x95-regel-c14-p08145095",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=//*[@id=\"product-price-74246\"]/span/span",
      "Value": "Virkespriser_lang_95x45",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "https://www.byggmax.se/friggebod-original-15m%C2%B2-sorselestugan-p7101345",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=//*[@id=\"product-price-190051\"]/span/span",
      "Value": "Stuga_Sorselestugan_Orginal_15kvm",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "https://www.byggmax.se/attefallshus-iris-199kvm-palmako-p7103740",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=//*[@id=\"product-price-193900\"]/span/span",
      "Value": "Stuga_Palmako_Iris_19kvm",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "https://www.byggmax.se/attefallshus-njuta-20-2-vibostugan-p7103526",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=//*[@id=\"product-price-149226\"]/span/span",
      "Value": "Stuga_ViboStugan_Njuta_20kvm",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "https://www.byggmax.se/attefallshus-njuta-25-2-vibostugan-p7103534",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=//*[@id=\"product-price-149242\"]/span/span",
      "Value": "Stuga_ViboStugan_Njuta_25kvm",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "https://www.beijerbygg.se/privat/sv/produkter/utemilj%C3%B6/stugor/attefallshus-friggebodar/stuga-kalix-25",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "5",
      "Value": "!TIMEOUT_WAIT",
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "xpath=//*[@id=\"store-select-prompt\"]/div/div/form/div/input",
      "Value": "85751",
      "Targets": [
        "xpath=//*[@id=\"store-select-prompt\"]/div/div/form/div/input",
        "xpath=//form/div/input",
        "css=#store-select-prompt > div > div > form > div > input"
      ],
      "Description": ""
    },
    {
      "Command": "if_v2",
      "Target": "${!STATUSOK}==true",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Beijer - Butik ej vald, fortsätter.",
      "Value": "green",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "linkText=Privatkund",
      "Value": "",
      "Targets": [
        "linkText=Privatkund",
        "xpath=//*[@id=\"store-select-prompt\"]/div/div/div[2]/a",
        "xpath=//div[2]/div/div/div/div[2]/a",
        "css=#store-select-prompt > div > div > div.expanded.button-group.store-select-prompt__button-group > a.button.primary.no-margin.js-consumerCustomerTypeButton"
      ],
      "Description": ""
    },
    {
      "Command": "else",
      "Target": "",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Beijer - Butik redan vald.",
      "Value": "green",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=//*[@id=\"pageContent\"]/div/div[3]/section[2]/div/div/div[4]/div[2]/div/div/div/div",
      "Value": "Stuga_ViboStugan_Kalix_25kvm",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "10",
      "Value": "!TIMEOUT_WAIT",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "https://www.beijerbygg.se/privat/sv/produkter/tr%C3%A4produkter/plank-reglar/byggreglar-c24/byggregel-45x95mm-c24",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=//*[@id=\"pageContent\"]/div/div[3]/section[2]/div/div/div[5]/div[2]/div/div/div/div",
      "Value": "Virkespriser95x45Beijer",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "https://www.lundqvisttravaru.se/produkter/fritidshus/kusthuset/",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=//*[@id=\"main\"]/div/section/div/div[2]/div/div/div/h2/span",
      "Value": "Lundqvist_kusthuset_vadersakrat",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=//*[@id=\"main\"]/div/section/div/div[2]/div/div/div/div/div/div[2]/p/strong",
      "Value": "Lundqvist_kusthuset_byggsats",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=//*[@id=\"main\"]/div/section/div/div[2]/div/div/div/h2/span[3]",
      "Value": "Lundqvist_kusthuset_farditOchIsolerat",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "fast",
      "Value": "!replayspeed",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "http://192.168.1.4:1880/RPA/Virke?pris=${Lundqvist_kusthuset_vadersakrat}&topic=Price-Lundqvist-kusthuset-vädersäkrat",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "http://192.168.1.4:1880/RPA/Virke?pris=${Lundqvist_kusthuset_farditOchIsolerat}&topic=Price-Lundqvist-kusthuset-Färdigt-och-isolerat",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "http://192.168.1.4:1880/RPA/Virke?pris=${Lundqvist_kusthuset_byggsats}&topic=Price-Lundqvist-kusthuset-byggsats-skal",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "http://192.168.1.4:1880/RPA/Virke?pris=${Virkespriser95x45}&topic=Price-Virke-45x95",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "http://192.168.1.4:1880/RPA/Virke?pris=${Virkespriser95x45Beijer}&topic=Price-Virke-45x95-Beijer",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "http://192.168.1.4:1880/RPA/Virke?pris=${Virkespriser_lang_95x45}&topic=Price-Virke-Lang-45x95",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "http://192.168.1.4:1880/RPA/Virke?pris=${Stuga_Sorselestugan_Orginal_15kvm}&topic=Price-Stuga-Sorselestugan-Orginal-15kvm",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "http://192.168.1.4:1880/RPA/Virke?pris=${Stuga_Palmako_Iris_19kvm}&topic=Price-Stuga-Palmako-Iris-19kvm",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "http://192.168.1.4:1880/RPA/Virke?pris=${Stuga_ViboStugan_Njuta_20kvm}&topic=Price-Stuga-ViboStugan-Njuta-20kvm",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "http://192.168.1.4:1880/RPA/Virke?pris=${Stuga_ViboStugan_Njuta_25kvm}&topic=Price-Stuga-ViboStugan-Njuta-25kvm",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "http://192.168.1.4:1880/RPA/Virke?pris=${Stuga_ViboStugan_Kalix_25kvm}&topic=Price-Stuga-ViboStugan-Kalix-25kvm-Beijer",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "false",
      "Value": "!errorIgnore",
      "Description": ""
    }
  ]
}

It will contain errors so it takes longer then the time out. Here are my powershell script that i use:

function WriteEventRPALog ($EventMessage, $Fas, $Macro, $Description){
    #write-host "Fas: $Fas"
    if ($Fas -eq 1){$Fas = 3001}
    if ($Fas -eq 2){$Fas = 3002}
    if ($Fas -eq 3){$Fas = 3003}
    if ($Fas -eq 4){$Fas = 3004}
    if ($Fas -eq 5){$Fas = 3005}
    if ($Fas -eq 6){$Fas = 3006}
    if ($Fas -eq 7){$Fas = 3007}
    if ($Fas -eq 8){$Fas = 3008}
    if ($Fas -eq 9){$Fas = 3009}
    if ($global:RPAMacro -eq "Remedy") {$Kategori = 1}
    if ($global:RPAMacro -eq "Smart-IT") {$Kategori = 2}
    Write-EventLog -LogName "RPA-Logs" -Source "Robot" -EventID $Fas -EntryType Information -Message "$EventMessage # $global:RPAMacro # $Description" -Category $Kategori
}

function Test-Administrator  
{  
    [OutputType([bool])]
    param()
    process {
        [Security.Principal.WindowsPrincipal]$user = [Security.Principal.WindowsIdentity]::GetCurrent()
        return $user.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
    }
}

Function ReadLogFile ($LogFile){
    $global:Fas1 = $null
    $global:Fas2 = $null
    $global:Fas3 = $null
    $global:Fas4 = $null
    $global:Fas5 = $null
    $global:Fas6 = $null
    $global:Fas7 = $null
    $global:Fas8 = $null
    $global:Fas9 = $null
    $global:Fas1Desc = $null
    $global:Fas2Desc = $null
    $global:Fas3Desc = $null
    $global:Fas4Desc = $null
    $global:Fas5Desc = $null
    $global:Fas6Desc = $null
    $global:Fas7Desc = $null
    $global:Fas8Desc = $null
    $global:Fas9Desc = $null
    $global:FasDone = $null
    $INI = Get-Content $LogFile
    #$INI
    $IniTemp = @()
    ForEach($Line in $INI)
    {
        If ($Line -ne "" -and $Line.StartsWith("[") -eq $True)
        {
            if ($Line.StartsWith("[echo]")) {
                #write-host "Data: $Line"
                $IniTemp += $Line
            }
            #if ($Line.StartsWith("[echo] INFO:")) {
            #    #write-host "Data: $Line"
            #    $IniTemp += $Line
            #}
        }
    }
    Write-Host
    Write-Host('=============================================')
    Write-Host
    ForEach($Line in $IniTemp)
    {
        #Write-host $Line
        if ($Line.StartsWith("[echo] INFO:")) {
            $LineInfo = $Line.Replace("[echo] INFO: ", "")
            Write-host  "Info: $LineInfo"
            if ($LineInfo.StartsWith("FAS1")) {$global:Fas1Desc =  $LineInfo}
            if ($LineInfo.StartsWith("FAS2")) {$global:Fas2Desc =  $LineInfo}
            if ($LineInfo.StartsWith("FAS3")) {$global:Fas3Desc =  $LineInfo}
            if ($LineInfo.StartsWith("FAS4")) {$global:Fas4Desc =  $LineInfo}
            if ($LineInfo.StartsWith("FAS5")) {$global:Fas5Desc =  $LineInfo}
            if ($LineInfo.StartsWith("FAS6")) {$global:Fas6Desc =  $LineInfo}
            if ($LineInfo.StartsWith("FAS7")) {$global:Fas7Desc =  $LineInfo}
            if ($LineInfo.StartsWith("FAS8")) {$global:Fas8Desc =  $LineInfo}
            if ($LineInfo.StartsWith("FAS9")) {$global:Fas9Desc = $LineInfo}
        }
        if ($Line.StartsWith("[echo] TIMER:")){
            $Line = $Line.Replace("[echo] TIMER: ", "")
            if ($Line.StartsWith("FAS1")) {$global:Fas1 = CleanString $Line}
            if ($Line.StartsWith("FAS2")) {$global:Fas2 = CleanString $Line}
            if ($Line.StartsWith("FAS3")) {$global:Fas3 = CleanString $Line}
            if ($Line.StartsWith("FAS4")) {$global:Fas4 = CleanString $Line}
            if ($Line.StartsWith("FAS5")) {$global:Fas5 = CleanString $Line}
            if ($Line.StartsWith("FAS6")) {$global:Fas6 = CleanString $Line}
            if ($Line.StartsWith("FAS7")) {$global:Fas7 = CleanString $Line}
            if ($Line.StartsWith("FAS8")) {$global:Fas8 = CleanString $Line}
            if ($Line.StartsWith("FAS9")) {$global:Fas9 = CleanString $Line}
            if ($Line.StartsWith("Done")) {$global:FasDone = CleanString $Line}
            $ReturnData = CleanString $Line
            Write-host "CleanString har returnerat: $ReturnData"
        }
    }
    Write-Host
    Write-Host('===============================================')
    Write-Host
    if ($global:Fas1 -ne $null){ 
        Write-host "Fas1 = $global:Fas1 sekunder"
        WriteEventRPALog $global:Fas1 1 $global:RPAMacro $global:Fas1Desc #$EventMessage, $Fas, $Macro, $Description
        }
    if ($global:Fas2 -ne $null){
        Write-host "Fas2 = $global:Fas2 sekunder"
        WriteEventRPALog $global:Fas2 2 $global:RPAMacro $global:Fas2Desc #$EventMessage, $Fas, $Macro, $Description
        }
    if ($global:Fas3 -ne $null){ 
        Write-host "Fas3 = $global:Fas3 sekunder"
        WriteEventRPALog $global:Fas3 3 $global:RPAMacro $global:Fas3Desc #$EventMessage, $Fas, $Macro, $Description
        }
    if ($global:Fas4 -ne $null){ 
        Write-host "Fas4 = $global:Fas4 sekunder"
        WriteEventRPALog $global:Fas4 4 $global:RPAMacro $global:Fas4Desc #$EventMessage, $Fas, $Macro, $Description
        }
    if ($global:Fas5 -ne $null){ 
        Write-host "Fas5 = $global:Fas5 sekunder"
        WriteEventRPALog $global:Fas5 5 $global:RPAMacro $global:Fas5Desc #$EventMessage, $Fas, $Macro, $Description
        }
    if ($global:Fas6 -ne $null){ 
        Write-host "Fas6 = $global:Fas6 sekunder"
        WriteEventRPALog $global:Fas6 6 $global:RPAMacro $global:Fas6Desc #$EventMessage, $Fas, $Macro, $Description
        }
    if ($global:Fas7 -ne $null){ 
        Write-host "Fas7 = $global:Fas7 sekunder"
        WriteEventRPALog $global:Fas7 7 $global:RPAMacro $global:Fas7Desc #$EventMessage, $Fas, $Macro, $Description
        }
    if ($global:Fas8 -ne $null){ 
        Write-host "Fas8 = $global:Fas8 sekunder"
        WriteEventRPALog $global:Fas8 8 $global:RPAMacro $global:Fas8Desc #$EventMessage, $Fas, $Macro, $Description
        }
    if ($global:Fas9 -ne $null){ 
        Write-host "Fas9 = $global:Fas9 sekunder"
        WriteEventRPALog $global:Fas9 9 $global:RPAMacro $global:Fas9Desc #$EventMessage, $Fas, $Macro, $Description
        }
    Write-host "Klar efter = $global:FasDone sekunder"
}

function CleanString ($InString){
    $MyData = $Line.SubString(0 ,($Line).IndexOf("-"))
    $MyData = $Line.Replace($MyData, "")
    #if ($Line.StartsWith("FAS")) {
        $MyData = $MyData.Replace("-", "")
        $MyData = $MyData.Replace(" ", "")
        $MyData = $MyData.Replace("s", "")
    #}
    return $MyData
}

function ConvertCSVtoExcel ([string]$CSVFile, [string]$ExcelFile){
    write-host "welcome to CSV to Excel converter"
    #Define locations and delimiter
    $csv = $CSVFile #Location of the source file
    $xlsx = $ExcelFile #Desired location of output
    $delimiter = "," #Specify the delimiter used in the file
    write-host "Converting: $csv to save it as: $xlsx with delimiter: $delimiter"
    # Create a new Excel workbook with one empty sheet
    $excel = New-Object -ComObject excel.application 
    $workbook = $excel.Workbooks.Add(1)
    $worksheet = $workbook.worksheets.Item(1)

    # Build the QueryTables.Add command and reformat the data
    $TxtConnector = ("TEXT;" + $csv)
    $Connector = $worksheet.QueryTables.add($TxtConnector,$worksheet.Range("A1"))
    $query = $worksheet.QueryTables.item($Connector.name)
    $query.TextFileOtherDelimiter = $delimiter
    $query.TextFileParseType  = 1
    $query.TextFileColumnDataTypes = ,1 * $worksheet.Cells.Columns.Count
    $query.AdjustColumnWidth = 1
    $query.TextFilePlatform = 65001 #Converts to readable ÅÄÖ (not utf8)

    # Execute & delete the import query
    $query.Refresh()
    $query.Delete()

    # Save & close the Workbook as XLSX.
    $Workbook.SaveAs($xlsx,51)
    $excel.Quit()
    Write-host "CSV to Excel converter done"
}

function PlayAndWait ([string]$macro, [string]$arg1, [string]$arg2, [string]$arg3, $WaitTime){
    $timeout_seconds = $WaitTime #max time in seconds allowed for macro to complete. Change this value if  your macros takes longer to run.
    $path_downloaddir = "C:\Skript\Run-UI.Vision-Macros\" #Where the script finds the kantu log files => *THIS MUST BE THE BROWSER DOWNLOAD FOLDER*, as specified in the browser settings
    $path_autorun_html = "C:/Skript/Run-UI.Vision-Macros/ui.vision.html" #autorun page exported from API setttings page.

    #Optional: Kill Chrome instances (if any open)
    #taskkill /F /IM chrome.exe /T 

    #Create log file. Here the RPA software will store the result of the macro run
    $log = "log_" + $(get-date -f MM-dd-yyyy_HH_mm_ss) + ".txt" 
    $path_log = $path_downloaddir + $log 

    #Build command line (1=CHROME, 2=FIREFOX, 3=EDGE)
    $browser = 1
    Switch ($browser) {
    1 {$cmd = "${env:ProgramFiles}\Google\Chrome\Application\chrome.exe"; break}
    2 {$cmd = "${env:ProgramFiles}\Mozilla Firefox\firefox.exe"; break} #For FIREFOX
    3 {$cmd = "${env:ProgramFiles(x86)}\Microsoft\Edge\Application\msedge.exe"; break} #For EDGE 
    }

    $arg = """file:///"+ $path_autorun_html + "?macro="+ $macro + "&direct=1&closeRPA=0&closeBrowser=0&savelog="+$log+""""
    if ($arg1 -eq $null){$arg1 = ""}
    if ($arg2 -eq $null){$arg2 = ""}
    if ($arg3 -eq $null){$arg3 = ""}
    $arg = $arg+"&cmd_var1="+$arg1+"&cmd_var2="+$arg2+"&cmd_var3="+$arg3
    write-host $arg
    #cmd_var1=helloworld&cmd_var2=helloworld2&cmd_var3=helloworld3&cmd_var4=helloworld4
    Start-Process -FilePath $cmd -ArgumentList $arg #Launch the browser and run the macro

    #############Wait for macro to complete => Wait for log file to appear in download folder
    $status_runtime = 0
    Write-Host  "Log file will show up at " + $path_log
    while (!(Test-Path $path_log) -and ($status_runtime -lt $timeout_seconds)) 
    { 
        $CPULoad = Get-WmiObject Win32_Processor | Measure-Object -Property LoadPercentage -Average | Select Average
        $CPULoad = $CPULoad.Average
        Write-Host  "Waiting for macro to finish, seconds=" $status_runtime "Cpu load avarage: $CPULoad %"
        $status_runtime = $status_runtime + 1 
    }

    #Macro done - or timeout exceeded:
    if ($status_runtime -lt $timeout_seconds)
    {
        #Read FIRST line of log file, which contains the status of the last run
        $status_text = Get-Content $path_log -First 1
        #Check if macro completed OK or not
        $status_int = -1     
        If ($status_text -contains "Status=OK") {$status_int = 1}
        Write-host ""
        write-host "$macro measurements of time spent:"
        ReadLogFile $path_log
    }
    else
    {
        $status_text =  "Macro did not complete within the time given:" + $timeout_seconds + " Killing the browser..."
        Sleep 3
        Taskkill /IM chrome.exe /F
         Start-Process -FilePath "C:\Program Files\Google\Chrome\Application\chrome.exe" -ArgumentList "https://www.google.se"
        #"C:\Program Files\Google\Chrome\Application\chrome.exe https://www.google.se"
        $status_int = -2
    }

    remove-item $path_log #clean up - Denna rensar bort logilen efter körning.
    Sleep 3
    #Remove-Item -Path "C:\RPA\Download\*.*"
    return $status_int, $status_text, $status_runtime
}

function RunRPA ([string]$macro, [string]$arg1, [string]$arg2, [string]$arg3, $WaitTime){
    #Tar bort nerladdade filer.
    #Remove-Item -Path "C:\RPA\Download\*.*" #Here is where the downloaded files from the browser is stored.
    #Remove-item -Path "C:\Users\hyperv\Desktop\uivision\datasources\*.*" #Here is where the .csv files are saved in direct storage mode.
    $global:RPAMacro = $macro
    write-host "Running this RPA flow: $global:RPAMacro"
    $admin = Test-Administrator
    if ($admin) {
        New-EventLog -source RPA -LogName RPA-Logs
        [System.Diagnostics.EventLog]::CreateEventSource("Robot", "RPA-Logs")
        } else {
        write-host "Skriptet körs inte som admin, kan ej skapa eventlogg. Detta behövs bara göras engång på en ny maskin. Finns redan loggen behövs inget göras."
        }
    $MyDate = Get-Date -format "yyyy-MM-dd_HH.mm"
    $MyFolder = $MyDate + "_" + $arg1
    #New-Item "C:\RPA\Reports\$MyFolder" -ItemType directory

    $result = PlayAndWait $macro """$arg1""" $arg2 $arg3 $WaitTime 

    $errortext = $result[1] #Get error text or OK
    $runtime = $result[2] #Get runtime
    $report = "Loop:" + $i + " Return code: " + $result[0]+ " Macro runtime: "+$runtime+" seconds, Result: "+ $errortext
    $report = $(get-date -f yyyy-MM-dd_HH:mm:ss)+" Macro "+$Macro+" runtime: ("+$runtime+" seconds), result: "+$result[0]+" & "+ $errortext
    Write-Host $report
    Add-content $testreport -value ($report)
    
    $CSVOrgFile = "C:\RPA\Download\$arg1.csv"
    $CSVFile = "C:\RPA\Reports\$MyFolder\$arg1.csv"
    $XlsxFile = "C:\RPA\Reports\$MyFolder\$arg1 - Summering.xlsx"
    #Check if csv file exist, then convert it.
    #if (Test-Path -Path $CSVOrgFile -PathType Leaf) {
    #    write-host "File: $CSVOrgFile exists, moveing on."
         #If file exist, move it and convert it.
         #Move files or they will be deleted.
         #Move-Item "C:\RPA\Download\*" "C:\RPA\Reports\$MyFolder"
         #ConvertCSVtoExcel $CSVFile $XlsxFile
     #} else {
        # If file dosent exist, wait and try to convert it.
     #   Write-host "Noting for me to do, not done? Will wait 20 sek and try again."
     #   Start-Sleep -Seconds 20
        #Move files or they will be deleted.
        #Move-Item "C:\RPA\Download\*" "C:\RPA\Reports\$MyFolder"
        #ConvertCSVtoExcel $CSVFile $XlsxFile
     #}
}

###########################################################################
#        Settings
###########################################################################
$testreport = "c:\Skript\Run-UI.Vision-Macros\testreport_2.0.txt"
###########################################################################
#        Main program starts here
###########################################################################

RunRPA Virkespriser "" "" "" 30
RunRPA Virkespriser "" "" "" 30

Sleep 5
Taskkill /IM chrome.exe /F

Created an account only to say: I have a reliable way to replicate the error.

Essentially I use a specific profile directory for Chrome on linux and I trigger an empty macro via command line: the script does not start and gives error 180. Ui vision up to date, version 8.0.1. I can share all needed to replicate (Profile directory, dummy script, and command). Runs fine on loads of other profiles.

I deleted most of my personal processes from the profile but I would rather not sharing openly on internet just in case - please let me know how to share that with you?

Hello @james - please send your information to team AT ui.vision - in your email please mention this forum post. Thanks, we look forward to testing it :slight_smile:

The same thing happens to me and managed to reproduce the error safely. In my case, the process is invoked by crontab every 2 hours. To prevent it from launching while it’s still running, before starting I run “killall /opt/google/chrome/chrome”. The problem is that if this killall is executed while the old process was working, the new process gives error 180.

How to simulate it?
run:
google-chrome “file:////home/ubuntu/RPA/dummy.html?direct=1&macro=folder/macro”

run while the macro is active:
killall /opt/google/chrome/chrome

run again:
google-chrome “file:////home/ubuntu/RPA/dummy.html?direct=1&macro=folder/macro”

Good news: A fix for this issue should be available in about one week :slight_smile:

The #180 issue is fixed with V8.1.1 :slight_smile:

1 Like

Hi, i upgraded to v8.1.1.
I dont get error 180. But after the first macro completes i get Error, no tab with id…
image
Closed chrome and tried again, same result. Reset all browser settings and same results. Rebooted my hyperv vm and same result. Is it just me or have any one else the same issue?
It works to run a macro manually via the UI vision addon in chrome, but not via powershell and task scheduler.

Hi @luvan We confirmed this regression bug. A fix is already on its way, V8.1.2 will be out in 1-2 days.