I'm getting this error every time I use FindElement(By.xpath("//... syntax instead of find_element_by_xpath(... etc, telling me that FindElement is not an attribute of webdriver. What form of declaration I have to write down to make it an attribute. I only use:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get('https://demoqa.com/text-box')
EnterFullName = driver.FindElement(By.xpath('//input[contains(@id,"userName")'])
EnterFullName.send_keys("Daniel Soth")
It is obviously working if I write down this line of code:
EnterFullName = driver.find_element_by_xpath('//*[@id="userName"]')
EnterFullName.send_keys("Daniel Soth")
However I'm intrigued by this FindElement attribute that is simply not working and I would like someone to explain why and what I need to declare in order to make it work.
FindElementatfind_elementis a method over the driver instance. I.e:driver.find_element(By.XPATH, ... )