Identifying the WebElement by “NAME” locator value.It takes String as an argument. If an element isn't identified it throws an exception as NoSuchElementException.
Syntax: driver.find_element(By.NAME,"locator_value")
Example: In the below example we will launch the webpage and enter the text in the edit box using NAME locator value.
ClassName_Locator.py
from selenium import webdriver
import time
from selenium.webdriver.common.by import By
driver = webdriver.Chrome("/Users/admin/Documents/Skill2Lead/Others/drivers/chromedriver.exe")
driver.get("http://www.dummypoint.com/seleniumtemplate.html")
time.sleep(2)
ele = driver.find_element(By.NAME,"entertext")
ele.send_keys("Skill2Lead_Name")
# OR
driver.find_element(By.NAME,"entertext").send_keys("Skill2Lead_Name")
time.sleep(5)
driver.quit()