Error: "Value for property is not a valid XML syntax."

Hi!!

I am currently working on an automation task that involves opening a web browser to download a file. This action is triggered by clicking a hyperlink, which redirects to a PDF. To accomplish this, I am utilizing the “For Each Ui Element” functionality, as the webpage contains multiple links that require clicking. However, a challenge has arisen due to a unique character (“&”) present in one of the links. I’m not sure if is this character in particular, but it seems it is.

This special character is causing an issue within UiPath, resulting in an error message such as: “Click ‘https://www.bocm.es/bol…’: Value for property [Target.Fuzzy selector] is not in a valid XML syntax.”.

The problematic link in question is: “https://www.boe.es/diario_boe/verifica.php?c=BOE-B-2023-19828&acc=Verificar&fix_bug_chrome=foo.pdf

I am actively seeking a solution to this problem and would greatly appreciate any guidance or insights you might have.

Best regards

  1. Assign Activity (to encode the URL):
    Create a new Assign activity in your workflow.
    Use the following code to encode the URL with the “&” character:

encodedUrl = System.Net.WebUtility.UrlEncode(“https://www.boe.es/diario_boe/verifica.php?c=BOE-B-2023-19828&acc=Verificar&fix_bug_chrome=foo.pdf”)

2. Click Activity (using the encoded URL):
 Use the `encodedUrl` variable in your `Click` activity instead of the original URL. UiPath will click the hyperlink with the correctly encoded URL.
1 Like

@Carla_Munoz

replace & with &

str.Replace("&","&")

or you can even use this

System.Net.WebUtility.HtmlEncode("str")

cheers

3 Likes

Thank you!!! This works

1 Like

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