分度器で、リンクテキストが次の方法で構成されていることを主張したいと思います: text-1 (ここで、テキストは変数であり、数値は任意の数字で構成できます)。
私は次のことを試しました:
browser.wait(
ExpectedConditions.visibilityOf(
element(by.xpath(`//a[@class = 'collapsed' and starts-with(text(), '${text}') and ends-with(text(), '-(/d+)')]`))),
5000)
と
browser.wait(
ExpectedConditions.visibilityOf(
element(by.xpath(`//a[@class = 'collapsed' and starts-with(text(), '${text}') and ends-with(text(), '/^-(/d+)$/')]`))),
5000)
残念ながら、上記の xpath はどれも機能しませんでした。
どうすればこれを修正できますか?