I'm trying to click on an icon that appears on the page however despite trying everything I can think of I keep getting the following error:
waiting for selector "[aria-label="Comment"]"
selector resolved to 2 elements. Proceeding with the first one.
selector resolved to hidden <svg role="img" width="24" height="24" fill="#8e8e8e"…>…</svg>
attempting click action
waiting for element to be visible, enabled and stable
element is visible, enabled and stable
scrolling into view if needed
element is not visible
retrying click action, attempt #1
waiting for element to be visible, enabled and stable
element is visible, enabled and stable
scrolling into view if needed
done scrolling
element is not visible
retrying click action, attempt #2
waiting 20ms
waiting for element to be visible, enabled and stable
etc etc etc.
So it looks like the element is hidden although I can't see any sign of that in the html....attached.
Any help greatly appreciated.
You can use nth
locator's method to get second element:
page.locator('svg[aria-label="Comment"]').nth(1);
or shorter version:
page.locator('svg[aria-label="Comment"] >> nth=1');
Keep in mind that's zero-based numbering.