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
  • 61
  • 4

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
  • 151,581
  • 34
  • 225
  • 281