Selector problem in web automation

I have already installed the chrome automation extension but I’m still no able to select certain panels on the screen like in gmail I’m able to select the task bar, menu bar but I cannot select the page element to enter the email id or other buttons like ‘next’. What do I do?

1 Like

@Yash_bitla99, I have trouble with these as well. Here’s some code to select the sign-in without a selector. I realize this is less than ideal. But it doesn’t require an appmask.

WebAutomation.LaunchChrome                      Url: "https://mail.google.com" \
                                                WindowState:WebAutomation.BrowserWindowState.Maximized \
                                                ClearCache:False \
                                                ClearCookies:False \
                                                BrowserInstance=> Browser
wait 0.3

MouseAndKeyboard.MoveMouse                      X: 1575 Y: 165 \
                                                RelativeTo:MouseAndKeyboard.MousePositionRelativeTo.Screen \
                                                MovementStyle:MouseAndKeyboard.MouseMovementStyle.Instant

MouseAndKeyboard.Click                          ClickType:MouseAndKeyboard.MouseClickType.LeftClick \
                                                MillisecondsDelay:300

wait 5

WebAutomation.CloseWebBrowser                   BrowserInstance: Browser 

Problems with using these non-selector-based automation workarounds like mine are:

  1. They aren’t robust. You need to get coordinates for the target in advance, one way or another. I use AutoHotkey’s WindowSpy, but I’m betting it can be done with Robin also.
  2. They may break if the user’s DPI scaling or screen resolution are different than what you code in.

I’m working on getting these coordinates in a way that will work regardless of DPI scaling or resolution, but I’m not there yet (not even close really).

Best regards,
burque505

1 Like

@Yash_bitla99, thanks once again to @jokoum, I’ve been able to work with Gmail without an appmask, but also without having to use coordinates. Here is some sample code for you:

# 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 ""]'

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  

Hope this helps.
Best regards,
burque505

1 Like

@burque505 Thanks alot

1 Like