playwright

use locator or handle to select elements.

locator : a select rule

.element_handle() to get handle.

locator can point to several elements, use .nth(i) to select single el, use .all() to get a list of single locators.

handle : a DOM

ElementHandle objects from different Locator instances are not equal even if they point to the same DOM element
You
cannot use == to check if Locators or ElementHandles point to the same DOM element.
Use id or xpath instead.