How to select the Day of a DateTime variable in a select date UI element

I don’t succeed to select the day in the UI element below
!!! to type the date is not possible

image

I tried the following 2 ways:

  1. “<webctrl aaname = '”+invoiceDate.Day.ToString+“'tag=‘LI’/>”

@Cardon_Cezar What is the Error that you get ?

Hi @supermanPunch

For the first try, this is the error:


RemoteException wrapping UiPath.Core.InvalidSelectorException: The selector is not valid —> RemoteException wrapping System.Xml.XmlException: ‘tag’ is an unexpected token. Expecting white space. Line 1, position 148.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ThrowExpectingWhitespace(Int32 pos)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
at UiPath.Core.Selector.FromXmlString(String xml)
at UiPath.Core.Selector…ctor(String theSelector)
— End of inner exception 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)

For second try, this is the error:

RemoteException wrapping UiPath.Core.SelectorNotFoundException: Cannot find the UI element corresponding to this selector: <html app='chrome.exe' title='New Invoice - CC RPA' /><webctrl aaname='{{invoiceDate.Day.ToString}}' parentid='leftMenu' tag='SPAN' />  ---> RemoteException wrapping System.Runtime.InteropServices.COMException: Cannot find the UI element corresponding to this selector: <html app='chrome.exe' title='New Invoice - CC RPA' /><webctrl aaname='{{invoiceDate.Day.ToString}}' parentid='leftMenu' tag='SPAN' /> 
   at UiPath.UiNodeClass.FindFirst(UiFindScope scope, String nodeID)
   at UiPath.Core.UiElement.FindFirst(FindScope scope, Selector selector, IPlaceholderResolver placeholderResolver)
	--- End of inner exception 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)

Please let me know if you want the workflow and/or the app’s credentials. I can provide both.

@Cardon_Cezar If you have noticed the Error Message, it is indicating the Selector which you have provided as {{invoiceDate.Day.ToString}} , I don’t think the Selector Accepts a method to be raised inside it, and hence instead of the value, it outputs the the variable name as it is.

you can use a String variable called day and set it to that value, and then use that value.

day = invoiceDate.Day.ToString

Then use {{day}} in the aaname of the selector.

Try it and let me know.

1 Like

Thank you, it worked!

1 Like

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