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?
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?
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)")))