Decide the action reading text of Chrome popup

Hello All,

In the process which I am doing, there are 2 Pop ups , once you submit the claim and, once if no such policy found , for both the popup sector is same but inner text is different.

Further action would be decided on the basis of text appear in popup , please suggest which activity should be used and how

Hello,

If the selector is the same, a simple if or a Flow decision based on it content (Get attribute innertext or else) should work fine and most likely will be the simplest way to do it if you have only two possibilities.

Flow switch and Switch activity having as decision the innertext would be a little more advance solution which could handle more text conditions and effectively check that the it has the specific texts that you expect.

https://activities.uipath.com/docs/switch

Cheers

Hey @Florent_Salendres thanks for response

I want to target Chrome Popups , identify the text click OK and do the action after that

I am not able to click OK by click activity and by Sending hot key as well

image

Hello,

This is a classic javascript popup generated by the webpage. What makes it difficult to get the text in your case in that you are using Google Chrome browser which is not rendered the same way as it would be for IE and do not expose it text attribute (among other ones).

From my side, chrome plugin makes also the capture very slow and anoying.
If you have choice, i would recommend you using rather Internet explorer on your automation in general because of the reason bellow.

This being said and if you still need/want to use chrome you could be achieving getting your text using the ‘Name’ attribute of the second Text element (first is the dialog title) UiElement.

Find here an example of a component which will attach to any Chrome popup and click the ok button (using a partial selector approach) and output the alert text as an argument. You could make it more specific adding the title of the window on the first selector.

Click_JSPopAndGetText.xaml (8.0 KB)

Cheers

10 Likes

Just modified the example working (for me) with latest version of Chrome.

  • the idx=2 part become first element.

  • The role attribute needed to be removed from button ‘OK’

Cheers
Click_JSPopAndGetText_2019.xaml (7.9 KB)

10 Likes

This is so cool. i have spent time last month to get it corrected - started from ur inital file. - thanks for updating the same here

2 Likes

Hi All,

I’m currently working on the Assignment 2 of Advanced Training, I’m facing trouble in identifying the pop-ups as I’m using Chrome browser. I’ve gone through few articles uploaded and learnt that using Internet Explorer is best option but what if I still want to use chrome, can this issue not be resolved?

Also I’ve followed this post and worked it out but still not able to resolve this.

Any other attempts to resolve it?

Thanks and regards,
Reema

Thanks. This worked perfectly for me.:grinning:

Hi!
The target selector you have used for Element Scope is :

<html app='chrome.exe' />
<ctrl role='dialog' />

Since its a dynamically created alert box message, its not working and also showing a validation error. I’m unsure as to how it works. Any help will be appreciated.
Thanks in advance!

1 Like

@Florent_Salendres This works! Thank you! I had to tweak my selectors a bit, but it works.

Try attaching to the browser first, then put the downloaded sequence in the “do” container.

Thanks @Florent_Salendres, that works for me in 2020 using the latest versions :+1:

@Florent_Salendres It works as a standalone project. But when I copy & paste / invoke it to one of my project, it didn’t work with below error message. Any idea?

20.4.3

Source: Click_JSPopAndGetText

Message: Value does not fall within the expected range.

Exception Type: System.ArgumentException

RemoteException wrapping System.ArgumentException: Value does not fall within the expected range.
at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

@Florent_Salendres I find it only works with UiPath.UIAutomation.Activities version 18.4.4 but not the latest 20.4.2.
As my whole process are developed on the latest one, any suggestion? Otherwise I have to try send hotkey.

@healsko_ho I am also getting the same error in version 20.4.3.

Please let me know if you have any solution for this.

@zoyebmansuri My solution is using Element Exists to check the specific text of the popup. Then click the push button ‘OK’ or else.

Selector of Element Exists as below:

image

1 Like

Hi @Florent_Salendres,
I came across this fix and curious to know on what basis you added idx=“2” in the selector.
Because it was working without idx=‘2’ earlier. Can you please explain?
In future, if chrome update happens I should able to select the correct selector for the popup.

I appreciate your response.

Thanks in advance

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.