Cast exception Json.Ling.JValue to type System.String


I am trying to click something on a webpage. For this click activity, I am creating a selector (called newSelector) that has one variable (called fileNameSave) in it, as that part will change everytime when I go through a loop.

fileNameSave is in string format. I create it from a datatable like this fileNameSave=row(0).ToString.

I use the variable “fileNameSave” inside my selector variable (called "newSelector):

and then it gives me an error.

However, when I use any other string variable I have instead of the “fileNameSave”, it works and that error does not appear.

Hi @JohannaKes,
Please share your workflow.
Also Just try once
aaname=‘“& fineNameSave &”’
and let me know it that works or not.


Did not work with & either.

It is very strange, even if I use the variable “fileNameSave”, and make it something else, for example:
fileNameSave = “hello everyone”
it will not give an error, but simply use that “hello everyone” normally.

Here is the file:
Click attachments.xaml (16.7 KB)

And here is what it is writing, if I put the datatable (read from a webpage) in the excel:
extractedAttachments.xlsx (9.7 KB)

Try to just write the value row(0).ToString and check wat value you are getting, may the row item is of the different data type and you are trying to cast it to string which is not possible.