0

This is how I find forms in a web-page using selmium:

driver.find_elements(by=By.XPATH, value="//form")

How can I edit my code to return only visible forms and those which are not disabled?

Daniel
  • 71
  • 1
  • 7

1 Answers1

-1

To locate the visible forms which are not disabled you can use either of the following locator strategies:

  • Using CSS_SELECTOR:

    elements = WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, "form:not(disabled)")))
    
  • Using XPATH:

    elements = WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.XPATH, "//form and not(disabled)")))
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352