python – Unable to fill the form using Selenium: AttributeError: ‘WebDriver’ object has no attribute ‘get_element_by_xpath’
There’s no method known as get_element_by_xpath
in Selenium-Python bindings.
Please use
driver.find_element_by_xpath("xpath here")
Also, Since find_element
internally looks for implicit waits to wait and interact with web element. Often, It has been observed that it is not a consistent method to look for web element/elements in Selenium automation.
Please use Explicit waits :
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "xpath here"))).send_keys("test")
You will need these imports as well.
Imports :
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
You can read more about waits from here
Read more here: Source link