I write XPath in Console to find icon element $x("//mat-icon")
.
Then I get list of elements:
0: <mat-icon class="mat-icon notranslate mat…-color ng-star-inserted" _ngcontent-cvb-c17="" aria-hidden="false" aria-label="start" role="img">
1: <mat-icon class="mat-icon notranslate mat…-color ng-star-inserted" _ngcontent-cvb-c17="" aria-hidden="false" aria-label="start" role="img">
and I want to pick the first one so I write index $x("//mat-icon[1]")
but it doesn't work. However, if I write $x("//mat-icon")[1]
it works, but when I write it in IDE error message appears:
driver.findElement(By.xpath("//mat-icon")[0]).click();