(Thanks to @jokoum) first steps at automating without appmasks

@jokoum posted the inspiration for this here. This automation doesn’t require an appmask.

All it does is navigate to the Amazon login page. The key is @jokoum’s code:

'domcontainer{<{<{<SelectorSeparator>}>}>}uia3:// #myFrame'

adapted to use a different ID. I haven’t tried it with classnames or tags yet, but rest assured I will. @jokoum, once again, I am totally in awe. I have no clue how you came up with this. Google searches for “SelectorSeparator” didn’t give me any information except two links to Oasis:

And yet … it works great. Here’s a screenshot:

… and the code.

# This works without an appmask to sign in to Amazon.
# Thanks, @jokoum!!!!!!!!!!
WebAutomation.LaunchChrome              Url:  "https://www.amazon.com" \
                                        WindowState:WebAutomation.BrowserWindowState.Maximized \
                                        ClearCache:false \
                                        ClearCookies:False \
                                        BrowserInstance=> Browser

WebAutomation.Click                     BrowserInstance:  Browser \
                                        Control: 'domcontainer{<{<{<SelectorSeparator>}>}>}uia3:// #nav-link-accountList' 

# Just so you can see it works ...
wait 5

WebAutomation.CloseWebBrowser           BrowserInstance: Browser

# Thanks a million to @jokoum for 'domcontainer{<{<{<SelectorSeparator>}>}>}uia3:// #myFrame'\ 
# from another post at "https://forum.robin-language.org/t/how-to-select-elements-of-iframes-in-robin-ui-spy/199/6" 
# which I have shamelessly pilfered! Long live @jokoum!!!!

(I get the niggling feeling that someone is going to say (or at least think) “You didn’t know that about ‘domcontainer{<{<{}>}>}uia3:// #nav-link-accountList’ ? What a noob!”
What can I say? True enough. :grinning:)

This is, incidentally, an answer to a question I had posed a while back about custom selectors.

EDIT: Works with Firefox also, just change the appropriate line to

WebAutomation.LaunchFirefox Url: "https://www.amazon.com" \

Best regards, and I hope this is of some use,
burque505

3 Likes

@burque505 thanks a lot for the great feedback, I really appreciate it! :smiley:

Here is the experiment I made so as to write a script and interact with a web page without using an appmask file!

2 Likes

This is a follow-up, automating Gmail sign-in.
I’m not sure why, but on my Win7 Pro 64-bit system both WebAutomation.Click and WebAutomation.PressButton don’t behave as I expected. The affected element turns yellow briefly and then reverts to its previous color, remaining focused. I need to send ‘Enter’ to complete the click, or use a MouseAndKeyboard action. EDIT: I suspect my pop-up blocker. See the animated GIF below the post.

UPDATE/RE-EDIT: I’ve confirmed that the pop-up blocker in Chrome will keep the WebAutomation.Click and WebAutomation.PressButton (at least on my system) from working properly.

If you look carefully at the animated GIF, you can see that Chrome notifies me that a pop-up has been blocked at exactly the same time I use

WebAutomation.PressButton 

in the code. I disabled pop-up blocking and was able to remove the lines

MouseAndKeyboard.SendKeys       TextToSend: "{Enter}" \
                                DelayBetweenKeystrokes:10

(I will experiment with turning off the blocker before automation starts, and then turning it back on when it’s done.)

This screenshot is truncated. The text entries are simply too long. The code contains everything, however.

In this code:

  1. The ‘domcontainer’ selector has been abbreviated.
  2. It’s been split up into multiple lines.
  3. The GMail sign-in button is pressed, which doesn’t for me open the tab.
  4. ‘Enter’ is sent to open the tab.
  5. The first tab is closed.
  6. We attach to the second tab (sign-in tab).
  7. We close the sign-in tab.

Caveats:
A) The URL for the sign-in tab has not been shortened; splitting it didn’t work for me.
i) The URL could probably be split into component variables and then concatenated.
B) The selector can probably be simplified further by quite a bit.

Code:

# Another use of @jokoum's appmask-less automation.
# See his posts at https://forum.robin-language.org/t/making-dynamic-controls/168/2
WebAutomation.LaunchChrome      Url:  "https://mail.google.com" \
                                WindowState:WebAutomation.BrowserWindowState.Maximized \
                                ClearCache:False \
                                ClearCookies:False \
                                BrowserInstance=> Browser

wait 2


# This selector has been modified. The original selector is:
#
# domcontainer{<{<{<SelectorSeparator>}>}>}uia3://  > body[class=""ng-scope""] > div[class=""hercules-header h-c-header h-c-header--product-marketing-one-tier header--desktop""] > div[class=""h-c-header__bar""] > div[class=""h-c-header__cta""] > ul[class=""h-c-header__cta-list header__nav--ltr""] > li[class=""h-c-header__nav-li g-mail-nav-links""]:eq(1) > a[class=""h-c-header__nav-li-link ""]
# 
# We don't need all that. It can be shortened as shown, and the long line can be broken up with '\'
#
WebAutomation.PressButton       BrowserInstance:  Browser \
                                Control: 'domcontainer{<{<{<SelectorSeparator>}>}>}uia3://  \
                                > li[class=""h-c-header__nav-li g-mail-nav-links""]:eq(1) \
                                > a[class=""h-c-header__nav-li-link ""]'

# On my system, I need to send 'Enter'. Perhaps you won't need this step
wait 1
# It seems like WebAutomation.PressButton should do this, but for me it doesn't.
# The element turns yellow briefly, then changes back to the original color,
# but stays focused.
MouseAndKeyboard.SendKeys       TextToSend: "{Enter}" \
                                DelayBetweenKeystrokes:10

wait 3
# Just for demo purposes

WebAutomation.CloseWebBrowser   BrowserInstance: Browser
# This only gets rid of the first tab.
# We need to close the second one also.
WebAutomation.AttachToChromeByUrl   TabUrl:  "https://accounts.google.com/signin/v2/identifier?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&sacu=1&rip=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin" \
                                    BrowserInstance=> Browser2
# This closes the sign-in tab.
WebAutomation.CloseWebBrowser   BrowserInstance: Browser2

Regards,
burque505

2 Likes