1

I'm trying to scrape the following URL: https://www.vivareal.com.br/venda/sp/holambra/imovel-comercial_comercial/. It has two pages only. However, there is a button in the bottom which I can locate via XPATH: "//*[contains(@title, "Página anterior")]".

I'm trying to set a variable for when the button is not clickable, like:

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[contains(@title, "Página anterior")]')))

But it returns an element, even if the element is not clickable (I'm testing manually too). Is there any sugestions? Thanks!

1 Answer 1

1

When the button is not clickable, it has an attribute called data-disabled; otherwise that attribute is missing. The attribute has no value, but if you use the following CSS Selector it should grab that element only if there is no data-disabled attribute:

driver.find_element_by_css_selector('a[title="Página anterior"]:not([data-disabled]')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.