Issue with Dynamic Selectors for Click Activity

Hi,

I am new to UiPath. I am trying to automate stock value extraction. I am having issue with a Click Activity Selector for long time. It is not consistent. I am using dynamic selector

  1. Using Assign activity ValToEnter =strStockName (value fetched from excel)
  2. Using Assign activity assigning

selector = <webctrl aaname='"& ValToEnter &"' parentid='mc_mainWrapper' tag='A'/> (where ValToEnter is the link I need to click in the page )

  1. In Click Activity to click the link I am providing the selector property as

> "<html htmlwindowname='/1039154/Moneycontrol/MC_Market/MC_Market_Internal_468x60' title='Stock Starting with ‘*’, List of Companies Stock Starting with ‘*' />"+selector

It is not working in my sequence file it gives me the below exception. Pls help

*RemoteException wrapping UiPath.Core.InvalidSelectorException: The selector is not valid  ---> RemoteException wrapping System.Xml.XmlException: ''' is an unexpected token. The expected token is ';'. Line 1,*
*position 202. *
*   at System.Xml.XmlTextReaderImpl.Throw(Exception e)*
*   at System.Xml.XmlTextReaderImpl.Throw(String res,*
*String[] args)*
*   at System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(String expectedToken1,*
*String expectedToken2)*
*   at System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(Int32 pos,*
*String expectedToken1,*
*String expectedToken2)*
*   at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue,*
*EntityExpandType expandType,*
*Int32& charRefEndPos)*
*   at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos,*
*Char quoteChar,*
*NodeData attr)*
*   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)*

Are you missing an apostrophe in the above selector at the end of the first selector? Should it be the following?

> "<html htmlwindowname='/1039154/Moneycontrol/MC_Market/MC_Market_Internal_468x60' title='Stock Starting with ‘*’, List of Companies Stock Starting with ‘*’' />"+selector

Not sure if that would be what’s throwing your error, the other thought I’d have is if combining the typed selector and the variable in the Click Activity is causing issues, maybe try combining them into the variable and inserting the selector beforehand, I know I had issues with this in the past.

EDITS: typos