I am trying to click at a href tag text, in this case "São Vicente":
<li>
<a href="/comprar-casas/braga/sao-vicente/mapa">São Vicente</a>
<span class="subdued">139</span>
</li>
Using the code:
zone = "São Vicente"
try:
tiredAF = page.locator('a:has-text("' + zone + '")')
tiredAF.click()
But playwright doesn't find anything.
Any idea on what is going wrong?
//Update
After debuggin the case, I could find out the follow message error is displayed:
=========================== logs ===========================
waiting for get_by_text("Vicente").first
locator resolved to <a href="/comprar-casas/braga/sao-vicente/mapa">São Vicente</a>
attempting click action
waiting for element to be visible, enabled and stable
element is not visible - waiting...
============================================================
I did in fact insert a time.sleep(10) to make sure everythin loads in the page, but it seems that was not enough.
Source page is https://www.idealista.pt/comprar-casas/braga/braga/braga/mapa