Drag and Drop fails

Hi guys,

I need a drag and drop for a web page. It fails but I noticed something strange - if you add a message box between click down and click up it works!

Please let me know if you experienced similar behavior and if message box somehow resets the page so that click up works fine. I need to run it end-to-end without message box or any assistance on the user side.

Note how it works with a message box

…now lets see what happens if you remove message box

and then I get a selector error

image

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
UiPath.Core.SelectorNotFoundException: Cannot find the UI element corresponding to this selector: ----> System.Runtime.InteropServices.COMException: Cannot find the UI element corresponding to this selector:
at UiPath.UiNodeClass.FindFirst(UiFindScope scope, String nodeID)
at UiPath.Core.UiElement.FindFirst(FindScope scope, Selector selector)
— End of inner ExceptionDetail stack trace —
at UiPath.Core.Activities.TaskAsyncCodeActivity`1.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

1 Like

Hi Ancher,

Sorry to hear you’re running into this. The behavior you’re seeing with the message box is interesting, but I think the problem might lie in your selectors. Seeing the error message you provide, we know it’s a “selector not found” issue, and we can see the selector in question. Two things I see in your selector that I typically try to avoid using are the fairly complex css-selector string (dynamic elements on the website could easily render this inaccurate) as well as the use of idx which refers to elements by their index on screen, and which can also be somewhat unreliable (with dynamic elements on the site, which DIV is the “third” DIV onscreen might change somewhat frequently). I would perhaps try to leverage an aaname, class or id of the element you’re trying to find, as these are often more reliable attributes to use when building a selector. You could also consider bringing in “higher levels” of the selector (leveraging the class/aaname/id of the element containing the element you’re interested in as well, for example).

If you’re able to share the .xaml from your workflow and people are able to access the site we can comment more specifically on how to select the specific element in question.

Best,

Evan

2 Likes

Hi Evan,

Thank you very much for elaborate analysis. Unfortunately, I cannot provide access to the app as it sits behind vpn, but here is .xaml file DragDrop-fail.xaml (10.9 KB)

Now I changed the selector to

image

Which points to this area

I am using CursorPosition = Center to make sure the item drops off to the dropzone, not the header.

Which still gives me this error.

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
UiPath.Core.SelectorNotFoundException: Cannot find the UI element corresponding to this selector: ----> System.Runtime.InteropServices.COMException: Cannot find the UI element corresponding to this selector:
at UiPath.UiNodeClass.FindFirst(UiFindScope scope, String nodeID)
at UiPath.Core.UiElement.FindFirst(FindScope scope, Selector selector)
— End of inner ExceptionDetail stack trace —
at UiPath.Core.Activities.TaskAsyncCodeActivity`1.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Also note that in the Studio and UiExlorer the selector shows as valid

Best,
Anatoly

1 Like

I managed to fix it by setting web attributes, still would be good to know if there is a reliable way to use drag and drop activities

1 Like

Hi Again Anatoly,

This scenario is one I’ve been thinking about a fair bit. At first, I was quite puzzled by the behavior, especially when you showed me that the selector validated and highlighted correctly.

What I believe is at play here (as it could also explain the pop-up box behavior you mentioned) is that there is something dynamic happening on the site. While I cannot confirm this without visiting the site, what I imagine is happening is something like this:

When I click and hold the item i want to drag, the site adds or changes elements in order to indicate to a (human) user what they can do. For example something like “Drop Here” or a similar message or highlight element indicating where the box can be dropped might be causing the website’s UI to change (and the selector to fail at runtime). Thinking back to the message box behavior you observed, I’m wondering if the reason it worked with the message box was that when the message box popped up, it removed focus from the site and caused the changes to the UI to revert back (allowing our selector to work).

If this is the case, a solution like yours (using web attributes) might be the most elegant. However, another option I’ve thought of would be using an activity like “Get Position” to find the location of the drop box (before I start clicking and dragging) and then after clicking to “pick up” my click and drag element, using the position we found to drop the element in that region.

It might also be possible to write the selector in such a way that it reflects the box you’re targeting after the dynamic changes that occur when picking up an element, but finding what this selector looks like might be a little difficult.

Best,

Evan

Hi Evan,

Thank you very much for the advice. I agree that something triggers the change, but it’s quite difficult to tell what exactly. I tested “Get Position” thing, which does look different to no-go drag-and-drop I had before in a way that now I see the cursor moving and dragging, but it still fails to drop it off.

So web attributes is my favorite, it works under most circumstances ( I am tempted to say all, but I have to run it for all scenarios to be sure )

Best regards,
Anatoly