{"id":2705,"date":"2020-04-22T17:59:33","date_gmt":"2020-04-22T12:29:33","guid":{"rendered":"https:\/\/www.h2kinfosys.com\/blog\/?p=2705"},"modified":"2024-09-25T17:53:04","modified_gmt":"2024-09-25T12:23:04","slug":"selenium-form-webelement","status":"publish","type":"post","link":"https:\/\/www.h2kinfosys.com\/blog\/selenium-form-webelement\/","title":{"rendered":"Selenium Form WebElement"},"content":{"rendered":"<h2><b>Selenium WebElement Form: TextBox, Submit button, sendkeys(), and Click()<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Forms are the web elements to receive basic information from the websites. Web forms have multiple GUI elements like Checkboxes, Textboxes, Radio buttons, Dropdown fields, Input fields, etc.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In this article, we will see how to identify the form elements using <a href=\"https:\/\/www.h2kinfosys.com\/courses\/selenium-webdriver-junit-training-course\">Selenium WebDriver<\/a>. Selenium encapsulates every element in the form as an object. We find the element using provided API and perform actions like entering text into text boxes, clicking the buttons, clicking Radio buttons, etc.<\/span><\/p>\n<h2><b>Introduction to WebElement, findElement(), findElements()<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Selenium WebDriver encapsulates every element in the form as an object of WebElement.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">There are different techniques through which the Selenium WebDriver identifies the WebElements which are based on different properties like Name, ID, XPath, CSS Selector, TagName, etc.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Selenium WebDriver provides two different methods to find the elements on the web page.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><b>findElement()<\/b><span style=\"font-weight: 400;\">\u00a0\u2013 This command will return the single <a href=\"https:\/\/www.h2kinfosys.com\/blog\/webdriver-script-java-example\/\">WebElement <\/a>on the web page and returns it as a WebElement object.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>findElements()<\/b><span style=\"font-weight: 400;\">\u00a0\u2013 This command will return a list of elements on the web page and finds the elements in a particular location using locators.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Let\u2019s see the example of how to get a single element \u2013 Using the findElement() method and getting the Text Field WebElement object on a web page.<\/span><\/p>\n<p><b>Step 1:<\/b><span style=\"font-weight: 400;\"> To create objects of Web Elements we need to import the below package<\/span><\/p>\n<p><b>import<\/b><span style=\"font-weight: 400;\"> org.openqa.selenium.WebElement;<\/span><\/p>\n<p><b>Step 2: <\/b><span style=\"font-weight: 400;\">We<\/span> <span style=\"font-weight: 400;\">need to call the findElement() method and get a WebElement object which is available on the WebDriver class.<\/span><\/p>\n<h3><b>InputBox<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Input boxes refer to below two types:<\/span><\/p>\n<ul>\n<li><b>Text Fields: <span style=\"font-weight: 400;\">Textboxes are used as input text from the user, and the entered text by the user will be visible as it is typed.<\/span><\/b><\/li>\n<li><b>Password Fields: <\/b><span style=\"font-weight: 400;\">It<\/span> <span style=\"font-weight: 400;\">input text from the user, but it uses some character to obscure the text as input. The text entered in this field is not visible to the user, it displays in an encrypted format.<\/span><\/li>\n<\/ul>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"size-full wp-image-2706 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_13.png\" alt=\"\" width=\"435\" height=\"351\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_13.png 435w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_13-300x242.png 300w\" sizes=\"(max-width: 435px) 100vw, 435px\" \/><\/p>\n<h3><b>Locators<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The findElement() method takes locator as parameter to the element. Multiple locators By.name(), By.id(), By.CSSSelector(), By.Xpath(), etc. locate the elements using properties like name, id, Xpath, etc.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">We use Inspect Element to the id, name, Xpath, etc. of the elements.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Using the example <\/span> <span style=\"font-weight: 400;\">https:\/\/login.yahoo.com\/<\/span><span style=\"font-weight: 400;\"> given below code is the code to locate the \u201cEmail address\u201d field using the <\/span><b>name<\/b><span style=\"font-weight: 400;\"> locator and the \u201cPassword\u201d field using the <\/span><b>id<\/b><span style=\"font-weight: 400;\"> locator.<\/span><\/p>\n<p><b>Step 1:<\/b><span style=\"font-weight: 400;\"> Go the site <\/span><span style=\"font-weight: 400;\">https:\/\/login.yahoo.com\/<\/span><\/p>\n<p><img decoding=\"async\" class=\"wp-image-2707 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_14.png\" alt=\"\" width=\"334\" height=\"523\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_14.png 418w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_14-191x300.png 191w\" sizes=\"(max-width: 334px) 100vw, 334px\" \/><\/p>\n<p><b>Step 2:<\/b><span style=\"font-weight: 400;\"> Right-click on the Email address field and select Inspect<\/span><\/p>\n<p><img decoding=\"async\" class=\" wp-image-2708 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_15.png\" alt=\"\" width=\"526\" height=\"572\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_15.png 632w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_15-276x300.png 276w\" sizes=\"(max-width: 526px) 100vw, 526px\" \/><\/p>\n<p><b>Step 3: <\/b><span style=\"font-weight: 400;\">Click on Inspect Icon and select the Email Address field to inspect.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-2709 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_16.png\" alt=\"\" width=\"693\" height=\"398\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_16.png 777w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_16-300x173.png 300w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_16-768x442.png 768w\" sizes=\"(max-width: 693px) 100vw, 693px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">The \u201cEmail Address\u201d text field name locator is <\/span><b>name<\/b><span style=\"font-weight: 400;\">=\u201dusername\u201d<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2710 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_17.png\" alt=\"\" width=\"596\" height=\"107\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_17.png 713w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_17-300x54.png 300w\" sizes=\"(max-width: 596px) 100vw, 596px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">The \u201cPassword\u201d text field id locator is <\/span><b>id<\/b><span style=\"font-weight: 400;\">=\u201dlogin-passwd\u201d<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2711 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_18.png\" alt=\"\" width=\"568\" height=\"94\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_18.png 707w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_18-300x50.png 300w\" sizes=\"(max-width: 568px) 100vw, 568px\" \/><\/p>\n<p>[box type=&#8221;shadow&#8221; align=&#8221;&#8221; class=&#8221;&#8221; width=&#8221;&#8221;]<\/p>\n<p><b>\/\/WebElement corresponding to the Email Address<\/b><\/p>\n<p><span style=\"font-weight: 400;\">WebElement email = driver.findElement(<\/span><span style=\"font-weight: 400;\">By.name(\u201cusername\u201d));<\/span><\/p>\n<p><b>\/\/WebElement corresponding to the Password field<\/b><\/p>\n<p><span style=\"font-weight: 400;\">WebElement password = driver.findElement(<\/span><span style=\"font-weight: 400;\">By.id(\u201clogin-passwd\u201d));[\/box]<\/span><\/p>\n<h3><b>Entering Values in Input Boxes<\/b><\/h3>\n<p><b>sendKeys()<\/b><span style=\"font-weight: 400;\"> is the method to enter the text into the Text Fields and Password Fields.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Using the example <\/span> <span style=\"font-weight: 400;\">https:\/\/login.yahoo.com\/<\/span><span style=\"font-weight: 400;\"> given below code is the code on how to find the Text field and Password fields and enter values into them.<\/span><\/p>\n<p><b>Scenario<\/b><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Find the \u201cEmail address\u201d field by using the name locator<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Find the \u201cPassword\u201d field by using the id locator<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Enter a email id into the &#8220;Email address&#8221; using the sendKeys() method.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Enter a password into the &#8220;Password&#8221; field by using the sendKeys() method.<\/span><\/li>\n<\/ol>\n<p>[box type=&#8221;shadow&#8221; align=&#8221;&#8221; class=&#8221;&#8221; width=&#8221;&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">\/\/<\/span><b>WebElement corresponding to the Email Address<\/b><\/p>\n<p><span style=\"font-weight: 400;\">WebElement email = <\/span><b>driver<\/b><span style=\"font-weight: 400;\">.findElement(By.name(\u201c<\/span><b>username<\/b><span style=\"font-weight: 400;\">\u201d));<\/span><\/p>\n<p><b>\/\/WebElement corresponding to the Password field<\/b><\/p>\n<p><span style=\"font-weight: 400;\">WebElement password = <\/span><b>driver<\/b><span style=\"font-weight: 400;\">.findElement(By.id(\u201c<\/span><b>login-passwd<\/b><span style=\"font-weight: 400;\">\u201d));\u00a0<\/span>[\/box]<\/p>\n<p><span style=\"font-weight: 400;\">email.<\/span>[highlight color=&#8221;green&#8221;]<strong>sendKeys<\/strong>[\/highlight]<span style=\"font-weight: 400;\">(\u201c<\/span><span style=\"font-weight: 400;\">qwerty@yahoo.com<\/span><span style=\"font-weight: 400;\">\u201d);<br \/>\n<\/span><span style=\"font-weight: 400;\">password.[highlight color=&#8221;green&#8221;]<strong>sendKeys<\/strong>[\/highlight]<\/span><span style=\"font-weight: 400;\">(<\/span><b>\u201c******\u201d<\/b><span style=\"font-weight: 400;\">);<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-2712 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_19.png\" alt=\"\" width=\"440\" height=\"317\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_19.png 509w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_19-300x216.png 300w\" sizes=\"(max-width: 440px) 100vw, 440px\" \/><\/p>\n<h3><b>Deleting Input Boxes Values<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The method <\/span><b>clear()<\/b><span style=\"font-weight: 400;\"> is used to delete the given value in an input box. The code will clear the entered text from the Email address and Password fields.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2713 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_20.png\" alt=\"\" width=\"488\" height=\"298\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_20.png 679w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_20-300x183.png 300w\" sizes=\"(max-width: 488px) 100vw, 488px\" \/><\/p>\n<h3><b>Buttons<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The <\/span><b>click()<\/b><span style=\"font-weight: 400;\"> method is used to access the buttons.<br \/>\n<\/span><span style=\"font-weight: 400;\">In the below example<\/span><\/p>\n<p><b>Scenario<\/b><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Find the Log In button<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Click on the \u201cLog In\u201d button to get login to the site<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">WebElement facebooklogin = driver.findElement(By.id(\u201c<\/span><span style=\"font-weight: 400;\">u_0_b\u201d));<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2714 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_21.png\" alt=\"\" width=\"557\" height=\"129\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_21.png 726w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_21-300x69.png 300w\" sizes=\"(max-width: 557px) 100vw, 557px\" \/><\/p>\n<h3><b>Submit Buttons<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Submit buttons are used to submit the complete form to the server. By using either submit() method or click() method on the web element in the form or on the submit button itself.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2716 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_22.png\" alt=\"\" width=\"562\" height=\"170\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_22.png 714w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_22-300x91.png 300w\" sizes=\"(max-width: 562px) 100vw, 562px\" \/><\/p>\n<h2><b>Complete Program<\/b><\/h2>\n<p><b>Below is the complete code for above all scenarios<\/b><\/p>\n<pre><span style=\"font-weight: 400;\">import org.openqa.selenium.By;<\/span>\n<span style=\"font-weight: 400;\">import org.openqa.selenium.WebDriver;<\/span>\n<span style=\"font-weight: 400;\">import org.openqa.selenium.chrome.ChromeDriver;<\/span>\n<span style=\"font-weight: 400;\">import org.openqa.selenium.*;<\/span>\n\n<span style=\"font-weight: 400;\">public class FormTesting {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0public static void main(String[] args) {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0System.setProperty(\"webdriver.chrome.driver\",\"<\/span> <span style=\"font-weight: 400;\">D:\\\\Drivers\\\\geckodriver.exe\");<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WebDriver driver = new ChromeDriver();<\/span> \n\n\n<span style=\"font-weight: 400;\">\u00a0String baseUrl = \"<\/span> <span style=\"font-weight: 400;\">https:\/\/www.facebook.com\/<\/span><span style=\"font-weight: 400;\"> \";<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0driver.get(baseUrl);<\/span>\n\n<b>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ Get the corresponding WebElement to the Email Address<\/b>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WebElement email = driver.findElement(By.name(\u201cemail\u201d));<\/span>\n\n<b>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ Get the corresponding WebElement to the Password Field<\/b>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WebElement password = driver.findElement(By.id(\u201cpass\u201d));<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0email.sendKeys(\"qwerty@gmail.com\");<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0password.sendKeys(\"qwerty1234\");<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(\"Entered Text Field Set\");<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0<\/span>\n<b>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ Deleting the entered values in the text box<\/b>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0email.clear();<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0password.clear();<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(\"Entered Text Field Cleared\");<\/span>\n\n<b>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ Find the submit button<\/b>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WebElement login = driver.findElement(By.id(\"<\/span><span style=\"font-weight: 400;\">u_0_b<\/span><span style=\"font-weight: 400;\"> \"));<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span>\n<b>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Click method to submit form<\/b> \n\n<span style=\"font-weight: 400;\">email.sendKeys(\"qwerty@gmail.com\");<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0password.sendKeys(\"qwerty1234\");<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0login.click();<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(\"Login Done with Click Option\");<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span>\n<b>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Using the submit method to submit the form. Submit used on the password field<\/b>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0driver.get(baseUrl);<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0driver.findElement(By.name(\u201cemail\u201d)).sendKeys(\"qwerty@gmail.com\");<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0driver.findElement(By.id(\u201cpass\u201d)).sendKeys(\"qwerty1234\");<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0driver.findElement(By.id(\"<\/span><span style=\"font-weight: 400;\">u_0_b<\/span><span style=\"font-weight: 400;\">\")).submit();<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(\"Login Done with Submit Operation\");<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h2><b>Conclusion<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">The below table summarizes the commands to access each type of element<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Element<\/b><\/td>\n<td><b>Command\u00a0<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><b>Input Box<\/b><\/td>\n<td><span style=\"font-weight: 400;\">sendKeys()<\/span><\/td>\n<td><span style=\"font-weight: 400;\">It is used to enter values into text boxes<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><span style=\"font-weight: 400;\">clear()<\/span><\/td>\n<td><span style=\"font-weight: 400;\">It is used to clear the value in the text box<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>Submit Button<\/b><\/td>\n<td><span style=\"font-weight: 400;\">submit()<\/span><\/td>\n<td><span style=\"font-weight: 400;\">It is used to submit the form<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>Links<\/b><\/td>\n<td><span style=\"font-weight: 400;\">click()<\/span><\/td>\n<td><span style=\"font-weight: 400;\">It is used to click on the link to get the page load<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Selenium WebElement Form: TextBox, Submit button, sendkeys(), and Click() Forms are the web elements to receive basic information from the websites. Web forms have multiple GUI elements like Checkboxes, Textboxes, Radio buttons, Dropdown fields, Input fields, etc. In this article, we will see how to identify the form elements using Selenium WebDriver. Selenium encapsulates every [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":2938,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[556,557,45],"class_list":["post-2705","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-selenium-tutorials","tag-form-webelement","tag-locators","tag-selenium"],"_links":{"self":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/2705","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/comments?post=2705"}],"version-history":[{"count":0,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/2705\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media\/2938"}],"wp:attachment":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media?parent=2705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/categories?post=2705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/tags?post=2705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}