# Get value of an input box using Selenium (Python)

SeleniumAutomation TestingTesting Tools

#### Selenium Online Training

46 Lectures 5.5 hours

#### Selenium 4 - New Features

22 Lectures 7 hours

#### New Selenium IDE

118 Lectures 17 hours

We can get the value of an input box with Selenium webdriver. The get_attribute() method is capable of obtaining the value we have entered in an input box. To get the value, we have to pass value as a parameter to the method.

First of all, we have to identify the input box with the help of any of the locators like id, class, name, css or xpath. Then we have to type some values inside it with the send_keys() method.

Let us consider the below input box where we shall enter some texts - Selenium Python and then fetch the value with get_attribute().

## Example

from selenium import webdriver
driver = webdriver.Chrome(executable_path="C:\chromedriver.exe")
driver.implicitly_wait(0.5)
driver.close()