Button picked up with “NM.GetElement” changes ID every time you reload the page

I am picking up a button with “NM.GetElement” and it picks it up correctly. But when I run the project the button changes ID every time you reload the page and OpenRPA does not find the button.

“[
{
“Selector”: “NM”,
“browser”: “chrome”,
“frame”: “-1”,
“url”: “YYY”
},
{
“xpath”: “//button[@id=\“1168485145645\”]”,
}
]”

I have tried everything, but I can’t get it fixed. any ideas?

Regards

Try searching by button text?
//button[contains(text(),“Buy now”)]

I have tried what you say in several ways and I can’t get it to work.

OpenRPA returns the following error:
{
“stack”: “Error: Failed to execute ‘evaluate’ on ‘Document’: The string ‘//button[contains(text(),"Crear la "]’ is not a valid XPath expression.\n at getelements (chrome-extension://hpnihnhlcnfejboocnckgchjdofeaphe/content.js:2715:41)\n at runtimeOnMessage (chrome-extension://hpnihnhlcnfejboocnckgchjdofeaphe/content.js:2490:26)”
}

The button text is: “Crear la Petición”. I thought it could fail because of the “ó” character, but it still fails, I have tried escaping the double quotes, using single quotes etc… But nothing works.

The html of the web is the following:

<button type="button" class="picto-button btn btn-md btn-primary" title="Crear la Petición " onclick="$.WizardAjax.openDialog('PHPSESSID=YYY&amp;init_wizard=true&amp;guid=SSS');" style="cursor: pointer; white-space: nowrap; width: auto;" id="21690167a08a54eda52" zn_id="12"><a style="white-space: nowrap;" href="#" onclick="$.WizardAjax.openDialog('PHPSESSID=YYY&amp;init_wizard=true&amp;guid=SSS');if (window.event != undefined) {var event=window.event;} event.cancelBubble = true;" zn_id="13">Crear la Petición</a></button>

Please post the selector in a codeblock
From the error it looks like you are missing a )

I have tried what you say in several ways and I can’t get it to work.

OpenRPA returns the following error:

[17:22:50.461][Output] Create EasyVista Ticket failed at 1.112 in 00:27.165
# {
  "stack": "Error: Failed to execute 'evaluate' on 'Document': The string '//button[@titlte=contains(text(),\"Crear la Petición\"]/a' is not a valid XPath expression.\n    at getelements (chrome-extension://hpnihnhlcnfejboocnckgchjdofeaphe/content.js:2715:41)\n    at runtimeOnMessage (chrome-extension://hpnihnhlcnfejboocnckgchjdofeaphe/content.js:2490:26)"
}

The button text is: “Crear la Petición”. I thought it could fail because of the “ó” character, but it still fails, I have tried escaping the double quotes, using single quotes etc… But nothing works.

The html of the web is the following:

type or paste code here<button type="button" class="picto-button btn btn-md btn-primary" title="Crear la Petición " onclick="$.WizardAjax.openDialog('PHPSESSID=YYY&amp;init_wizard=true&amp;guid=SSS');" style="cursor: pointer; white-space: nowrap; width: auto;" id="21690167a08a54eda52" zn_id="12"><a style="white-space: nowrap;" href="#" onclick="$.WizardAjax.openDialog('PHPSESSID=YYY&amp;init_wizard=true&amp;guid=SSS');if (window.event != undefined) {var event=window.event;} event.cancelBubble = true;" zn_id="13">Crear la Petición</a></button>

OpenRPA Selector:

[
  {
    "Selector": "NM",
    "browser": "chrome",
    "frame": "-1",
    "url": "https://AAA/index.php?mnRoot=2%2F2%2F0&eventName=HelpDesk_NewRequestFullfilmentItem&q2_tree_id=7764&q2_value_selected=UmVkZXM%3D&q2_treetable=7&q2_clickfield=1&q2_cnt=1&OnChangeFilter=false&PHPSESSID=YYY&forcerefresh=true&dontaskdynamicfilter=1&internalurltime=1738599998&clickpage=1"
  },
  {
    "xpath": "//button[contains(text(),\"Crear la Petición\"]/a"
  }
]

sorry I posted an error from one of the tests I did, the error I get when I test what you said is this:

[17:30:22.678][Output] Create EasyVista Ticket failed at 1.112 in 00:24.829
# {
  "stack": "Error: Failed to execute 'evaluate' on 'Document': The string '//button[contains(text(),\"Crear la Petición\"]/a' is not a valid XPath expression.\n    at getelements (chrome-extension://hpnihnhlcnfejboocnckgchjdofeaphe/content.js:2715:41)\n    at runtimeOnMessage (chrome-extension://hpnihnhlcnfejboocnckgchjdofeaphe/content.js:2490:26)"
}

The error is the same, only the string changes.

yes, you are missing a )

"xpath": "//button[contains(text(),\"Crear la Petición\"]/a"

should be

"xpath": "//button[contains(text(),\"Crear la Petición\")]/a"

Thank you very much for the help, I am just starting and I do not master this type of programs nor Visual Basic.

I solved it with the following selector:

 "xpath": "//a[contains(text(),\"Crear la Petición\")]"

Regards