I've spent a couple of hours trying to click on a button using various selectors before asking a question here, but nothing seems to work
WebElement add= driver.findElement(By.partialLinkText("+"));
WebElement add= driver.findElement(By.xpath("/*[name()='svg']/*[name()='button']"));
WebElement confirm = driver.findElement(By.xpath("//a[contains(@class, 'IconButton-h85035-0 indexstyles__PlusButton')]"));
No available examples have a similar html layout as the page I'm working with. I am not sure how to create the xPath to the button. I would appreciate any hints on how to create xPath, or the CSS selector, no ready solution is expected, but any help to understand how to refere to that particular element.
That is the code of the plus button:
<button data-testid="tselectionSpinbuttonPlus" type="button" tabindex="-1" aria-hidden="true" width="44px" height="44px" class="IconButton-h85035-0 indexstyles__PlusButton-sc-108enfc-3 bAZDfp">
<svg viewBox="0 0 24 24" width="1.5em" height="1.5em" aria-hidden="true" focusable="false" class="BaseSvg-sc-9y47q5-0 PlusIcon___StyledBaseSvg-sc-11rza9m-0 VCaQT">
<path d="M13 11V3h-2v8H3v2h8v8h2v-8h8v-2h-8z">
</path>
</svg>
</button>