RPA ignores xpath contains condition


I have this xpath for a mouse click action
(//*[@id=‘yuievtautoid-0’]/tbody[2]/tr/td[4]/div/h3/span[2]/a[contains(text(),‘OPF’) or contains(text(),’(OPF’)])[${j}]

However it ignores the file if a file is named as (OPF 258) or 1234589 (OPF No 258) or Lenovo Adapter Soma (OPF No 529) and instead detects only file names starting with OPF, for example a file named OPF 258

Interestingly, there are also these points to be considered :

  1. The XPath successfully detects all the file names containing ‘OPF’ disregarding the position of OPF or whether it is surrounded by a parenthesis or not, in the developer panel of chrome.

  2. I have extracted all the file names to a list variable using the same path and it contains all the files containing ‘OPF’ string.

So what could be the issue that causes mouse click action to ignore the file containing ‘(OPF’ or files named like this eg: 1234589 (OPF No 258) ?

Any help or advice would be appreciated, thank you.

Hi @yeahalti can you share the url on which you need to click the Xpath?

In theorym this Xpath should find file with names like (OPF 258) or 1234589 (OPF No 258), too.

No, unfortunately I can’t, as it is classified data.

Got it.
With the Xpath above without condition, does the bot skip names in e (OPF 258) or 1234589 (OPF No 258), too?

No, it doesn’t.

I tried this for xpath (//*[@id=‘yuievtautoid-0’]/tbody[2]/tr/td[4]/div/h3/span[2]/a[text()[contains(.,‘OPF’)]])[${j}] and it successfully opened the links containing parenthesis or ones that didn’t begin with OPF as a starting string. However, after sometime, the mouse click started to (the mouse click was supposed to open the files and then back trace again.) ignore all of the files containing “OPF”.

It should be noted that the operation Web Element with the same xpath but just with the addition of extracting href attribute, was still able to save the href links of all the files containing “OPF” to a variable accurately.

What do you think could be causing the error?

This is a partial solution. It is important that the page scrolls to the part you want to open through cursor click, thus related to my problem, it is essential that it scrolls to the OPF it wants to open, if the OPF isn’t shown on the current screen page, it will not open it and thereby ignore it.