Error when trying to delete all Authenticator extension accounts

Hi all, maybe someone could help me. I’m trying to automate the deletion of accounts in Authenticator extension.

My code it works almost fine, but I’m not sure why is having some weird behavior when finishes, since instead to exit from Authenticator extension after deleting all accounts, the mouse goes to positions I’m not telling it to go.

Additionally, if there is no accounts or after deletes the last account, gives error in the command that clicks in “Yes” button. XClick | 4Yes_dpi_108.png

If someone could give a try to fix my current code, I’m attaching the exported macro with its images used by 4 XClick commands DeleteAuthenticatorAccounts.zip (4.9 KB).

And can import the tests accounts I show below doing this.

Click in Authenticator Settings -> Backup -> Import Backup -> Import Text Backup -> Paste the text below -> Finally click in Import Text Backup

Test accounts:
otpauth://totp/Coinbase:test1%40testemail.com?secret=Thisisatest&issuer=Coinbase otpauth://totp/eBay:test6%40test-email.com?secret=Thisisatest&issuer=eBay otpauth://totp/Evernote:test5%40test-email.com?secret=Thisisatest&issuer=Evernote otpauth://totp/DreamHost:test4%40test-email.com?secret=Thisisatest&issuer=DreamHost

This is the macro in json:

{
  "Name": "DeleteAuthenticatorAccounts",
  "CreationDate": "2024-4-9",
  "Commands": [
    {
      "Command": "store",
      "Target": "true",
      "Value": "!errorignore",
      "Description": ""
    },
    {
      "Command": "XDesktopAutomation",
      "Target": "true",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "XClick",
      "Target": "1_dpi_108.png",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "XClick",
      "Target": "2pen_dpi_108.png",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "visualVerify",
      "Target": "3Del_dpi_108.png",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "while_v2",
      "Target": "${!statusOK}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "XClick",
      "Target": "3Del_dpi_108.png",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "XClick",
      "Target": "4Yes_dpi_108.png",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "visualVerify",
      "Target": "3Del_dpi_108.png",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "XType",
      "Target": "${KEY_ESC}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "false",
      "Value": "!errorignore",
      "Description": ""
    }
  ]
}```

The steps to delete each account are below in text and with an image:
1-) Click in Authenticator App
2-) Click in pencil icon
3-) Loop to click in each red circle to delete each account
4-) Confirm for each account clicking in “Yes” button.

Thanks in advance.

Hi, that is a very interesting test case for automating a browser extension. I took the time and created a short video on how I automated it. My macro works fine, so I am not sure exactly what goes wrong with your macro. I did not run your macro, but I also see no obvious issue when looking at the source. => Does my macro work for you?

Video:

Source:

{
  "Name": "DeleteAllAccounts",
  "CreationDate": "2024-4-11",
  "Commands": [
    {
      "Command": "XClick",
      "Target": "icon_dpi_168.png",
      "Value": "",
      "Description": "open extension"
    },
    {
      "Command": "XClick",
      "Target": "pen_dpi_168.png",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!errorignore",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "2",
      "Value": "!timeout_wait",
      "Description": ""
    },
    {
      "Command": "do",
      "Target": "",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!statusOK",
      "Description": ""
    },
    {
      "Command": "XClick",
      "Target": "reddot_dpi_168.png",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "XClick",
      "Target": "yes_dpi_168.png",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "repeatIf",
      "Target": "${!statusOK} == true",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Done deleting :)",
      "Value": "green",
      "Description": ""
    }
  ]
}
2 Likes

Thanks @admin for your help and time. Interesting for me how you handle the errors so fast hehe. I’ve tried your macro changing only the images, since in my case, not sure why when I use the select command, the images are created ending in 108.png and I see in your case appears 168.png. Why that happens?

Regarding the result with your macro, is the same as with my macro. Deletes all accounts and at the end, the macro gives click in the profile icon of my account in chrome (the image in a circle next to the 3 vertical dots in top right corner) . Not sure what that happens and I’ve added at the end a “ESC” but doesn´t work.

Finally, I made a second macro as a workaround, only if you have the chance to see it a uploaded here DeleteAuthAccounts.zip (3.5 KB). This other macro give right click in the Authenticator icon, then options and then should check the box and click in reset. That removes all accounts too, but the issue is that at least for me, when I do click in “options”, the Authenticator window that appears is bouncing very fast. Then my only option was to do a inspect and the send 2 javascript commands directly in console. But for some reason, sometimes works (sends the javascript commands in console) and sometimes doesn´t (the commands are not typed inside dev tools console).

Regards

I think the issue is that when all the “red dots” are gone (all accounts deleted) the image search finds something else that is kind of similar to the red dots. You can prevent this by increasing the confidence level from the default of 0.6 to e. g. 0.9 - this avoids clicking in the wrong place.

To do this, add @0.9 to the command:
{
“Command”: “XClick”,
“Target”: “reddot_dpi_168.png@0.9”,
“Value”: “”,
“Description”: “”
},

_168 helps Ui.Vision to automatically downscale the image when moving to another machine with different screen resolutions. My images are _168 instead of _108 because I use a HiDPI monitor with a higher resolution and 150% scaling. The default for a normal screen with no scaling is _96. But you do not think about this, Ui.Vision creates these values automatically.

1 Like

I’ll try changing the conf level to 0.9. I understand what you say and has sense, it looks for another circular image. What I don’t understand yet if if the condition to stop the loop already was got, why is executing that command one more time.

My first version of this macro was done with do/repeat and then I changed to while/do and even within both blocks I added an if/end block trying to avoid the extra execution of that command but no matter what I do, always executes that command when there no more red dots.

Thanks again for your help

I checked your code and you do a visual verify check on 3Del_dpi_108.png just before “End”. But since “something like this image” is almost always found somewhere on the screen at confidence = 0.6, the status of this command is “true”. Increasing the confidence level of this check to 0.9 should fix it.

A very robust way of detecting that you are done would be the check for the red color of the topmost (-) icon. When this icon is gone, you know you are done.

So what you use is visualGetPixelColor | ${!imageX}, ${!imageY}. The image X/Y values are automatically provided by the XClick | 3Del_dpi_108.png command that you have. And when the color is red, you know that it was a good click on the right icon.

image

Adding conf level of 0.90 fixed the issue.

visualSearch | 3Del_dpi_108.png@0.90

Thanks for the other tip about how to use visualGetPixelColor, I didn´t know. What I was thinking before is try to limit the search area of XClick for the red dot to search only within the Authenticator extension area. But I don´t know how to dynamically get x1,y1 and x2,y2 thinking that this macro could be used in another machine too.

Thanks a lot @admin and @ulrich for such valuable support.

Regards

2 Likes

Great to hear that it worked!

I did not test it, but that is a good idea, too! It should work. The command to use for this would be visionLimitSearchAreaRelative with an image like this:

This will limit the image search area to everything inside the pink box.

1 Like