{"id":95506,"date":"2018-07-03T12:00:08","date_gmt":"2018-07-03T12:00:08","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=95506"},"modified":"2018-07-04T09:57:02","modified_gmt":"2018-07-04T09:57:02","slug":"performing-events-selenium-webdriver","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/","title":{"rendered":"Performing Events in Selenium WebDriver"},"content":{"rendered":"<p>In the <a href=\"https:\/\/webkul.com\/blog\/element-locators-in-selenium\/\" target=\"_blank\" rel=\"noopener\">previous<\/a> post, we learnt <a href=\"https:\/\/webkul.com\/blog\/element-locators-in-selenium\/\" target=\"_blank\" rel=\"noopener\">how to locate elements<\/a> in webpage using WebDriver. After locating an element, we obviously need\/want to perform some activity\/event on it. The event could be clicking the element, typing something (filling a form) or getting the content present under the element. Now let&#8217;s see some common events which we can use while writing a script in selenium WebDriver.<\/p>\n<ol>\n<li>Selecting\/accessing an input element.<\/li>\n<li>Accessing a button.<\/li>\n<li>Accessing\/operating drop-downs.<\/li>\n<\/ol>\n<div class=\"panel panel-primary\">\n<div class=\"panel-heading\">\n<div>\n<h3 class=\"panel-title\">Selecting\/accessing an input element.<\/h3>\n<\/div>\n<\/div>\n<div class=\"panel-body\">\n<p>Input elements are most commonly used elements in a form or a webpage (which takes some input from user). An input element can be of a text type or can be a password type (which shows &#8216;*&#8217; while writing something on them). The text fields accept the entered value and show as it is (the way they are typed). In a password filed, they generally mask the typed value usually by dots or\u00a0asterisks to avoid the sensitivity of the content.<br \/>\nConsider the following example, we will select an input element and \u00a0will try to enter some value to it.<\/p>\n<div>\n<div class=\"para-images\">\n<div><a href=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/asseccing_email.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" class=\"alignnone\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/asseccing_email.jpg\" alt=\"\" width=\"916\" height=\"670\" loading=\"lazy\" \/><\/a><a href=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/accessing_password.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" class=\"alignnone\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/accessing_password.jpg\" alt=\"\" width=\"917\" height=\"641\" loading=\"lazy\" \/><\/a><\/div>\n<\/div>\n<p>In the above images, we have two elements. The first element takes email as its input type and the other takes password as its input type. Consider we want to enter values as email-&#8216;himanshu.chand168@webkul.com&#8217; and password- &#8216;secret&#8217;. We can get the first element by it&#8217;s attribute id and second by it&#8217;s name (Different type of locators are explained <a href=\"https:\/\/webkul.com\/blog\/element-locators-in-selenium\/\">here<\/a>).<\/p>\n<h3>Entering values to input element :<\/h3>\n<p>To enter some values in an element, we use the method &#8216;sendKeys&#8217;.<\/p>\n<ul>\n<li>driver.getElementBy.id(&#8220;email&#8221;).sendkeys(&#8220;himanshu.chand168@webkul.com&#8221;);<\/li>\n<li>driver.getElementBy.name(&#8220;password&#8221;).sendkeys(&#8220;secret&#8221;);<\/li>\n<\/ul>\n<h3>Deleting values form input element :<\/h3>\n<p>To enter some values in an element, we use the method &#8216;clear&#8217;.<\/p>\n<ul>\n<li>driver.getElementBy.id(&#8220;email&#8221;).clear();<\/li>\n<li>driver.getElementBy.name(&#8220;password&#8221;).clear();<\/li>\n<\/ul>\n<p>Lets see a simple code which\u00a0 invokes the sendKeys method to enter text in the username and password element.<\/p>\n<\/div>\n<pre>package accessInputElements;\r\nimport org.openqa.selenium.By;\r\nimport org.openqa.selenium.Keys;\r\nimport org.openqa.selenium.WebDriver;\r\nimport org.openqa.selenium.chrome.ChromeDriver;\r\nimport org.openqa.selenium.firefox.FirefoxDriver;\r\nimport org.testng.annotations.Test;\r\npublic class AccessInputElements { \r\n WebDriver driver; \r\n @Test \r\n public void accessInputElements() throws InterruptedException {\r\n   chrome_path = System.getProperty(\"user.dir\") + \"\/chromedriver\";\r\n   System.setProperty(\"webdriver.chrome.driver\", chrome_path);\r\n   driver = new ChromeDriver(); \r\n   driver.manage().window().maximize(); \r\n   driver.navigate().to(\"https:\/\/himanshu-shop.myshopify.com\/admin\");\r\n   driver.findElement(By.id(\"Login\")).clear(); \/\/To clear the pre-filled content of element\r\n   driver.findElement(By.id(\"Login\")).sendKeys(\"himanshu.chand168@webkul.com\"); \r\n   driver.findElement(By.id(\"Password\")).sendKeys(\"secret\"); \r\n   driver.close(); \r\n }\r\n}<\/pre>\n<\/div>\n<\/div>\n<div class=\"panel panel-primary\">\n<div class=\"panel-heading\">\n<div>\n<h3 class=\"panel-title\">Accessing a button<\/h3>\n<\/div>\n<\/div>\n<div class=\"panel-body\">\n<p>A button can majorly be divided in three types. A submit button, radio button and a check box. We can access a button and preform an event by simply clicking on it.<br \/>\nLets see how we can perform events on different types of button:<\/p>\n<h3>A simple button:<\/h3>\n<p>To access a button we can just look for the best element locator which refers the button. We can perform a click action using &#8220;click&#8221; method.<\/p>\n<ul>\n<li>driver.getElementBy.name(&#8220;password&#8221;).click();<\/li>\n<\/ul>\n<h3>Submit Button:<\/h3>\n<p>&lt;input type=&#8221;submit&#8221;&gt; defines a button for submitting the form data to a form-handler. We can perform a submit auction to submit the form at any input which is under a particular form.<\/p>\n<ul>\n<li>driver.getElementBy.name(&#8220;password&#8221;).submit();<\/li>\n<\/ul>\n<p><strong>Note:<\/strong><\/p>\n<p>&lt;input type=&#8221;button&#8221; \/&gt; buttons will not submit a form &#8211; they don&#8217;t do anything by default. They&#8217;re generally used in conjunction with JavaScript as part of an AJAX application, so we need to click a these types of inputs.<\/p>\n<p>&lt;input type=&#8221;submit&#8221;&gt; buttons will submit the form they are in when the user clicks on them, unless you specify otherwise with JavaScript. We can use &#8220;Enter&#8221; key-press on a form and submit the form automatically if there is a submit button<\/p>\n<p>Lets see a simple code which\u00a0 invokes a click event to a button and a submit event :<\/p>\n<pre class=\"brush:java\">package accessInputElements;\r\nimport org.openqa.selenium.By;\r\nimport org.openqa.selenium.Keys;\r\nimport org.openqa.selenium.WebDriver;\r\nimport org.openqa.selenium.chrome.ChromeDriver;\r\nimport org.openqa.selenium.firefox.FirefoxDriver;\r\nimport org.testng.annotations.Test;\r\npublic class AccessInputElements { \r\n WebDriver driver; \r\n @Test \r\n public void accessInputElements() throws InterruptedException {\r\n   chrome_path = System.getProperty(\"user.dir\") + \"\/chromedriver\";\r\n   System.setProperty(\"webdriver.chrome.driver\", chrome_path);\r\n   driver = new ChromeDriver(); \r\n   driver.manage().window().maximize(); \r\n   driver.navigate().to(\"https:\/\/himanshu-shop.myshopify.com\/admin\");\r\n\/\/ To clear the pre-filled content of element\r\n   driver.findElement(By.id(\"Login\")).clear(); \r\n   driver.findElement(By.id(\"Login\")).sendKeys(\"himanshu.chand168@webkul.com\"); \r\n   driver.findElement(By.id(\"Password\")).sendKeys(\"secret\");\r\n\/\/ Here the button input type is 'submit' so we can submit the form using to methods\r\n\/\/ 1. By clicking the button \r\n   driver.findElement(By.id(\"LoginSubmit\")).click();\r\n\/\/ 2. By using .submit to any input which exists under the form   \r\n   driver.findElement(By.id(\"Password\")).submit();\r\n   driver.close(); \r\n }\r\n}\r\n\r\n<\/pre>\n<h3>Radio Buttons and Check Box:<\/h3>\n<p>Radio Buttons and\u00a0check box too can be toggled on by using the <strong>click()<\/strong> method. But only toggling a checkbox\/radio button is not a job, before it we need to first see if a check box is already checked or if the\u00a0Radio Button\u00a0is selected by default.<\/p>\n<p>Lets see a simple code which\u00a0 selects a radio button and checks a checkbox:<\/p>\n<pre class=\"brush:java\"> List  radioButtons = driver.findElements(By.name(\"radio_button\"));\r\n boolean bSelected = false;\r\n bSelected = radioButtons.get(0).isSelected(); \/\/ check if first radio button is selected\r\n if(bSelected )\r\n    radioButtons.get(1).click();        \/\/ if first radio button is selected, we select second button\r\n else\r\n    radioButtons.get(0).click();        \/\/ if first radio button is not selected then we select it<\/pre>\n<div class=\"para-images\">\n<div><img decoding=\"async\" class=\"alignnone\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/aRadioButton.jpg\" alt=\"\" width=\"961\" height=\"605\" loading=\"lazy\" \/><img decoding=\"async\" class=\"alignnone\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/aCheckbox.jpg\" alt=\"\" width=\"969\" height=\"500\" loading=\"lazy\" \/><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<div class=\"panel panel-primary\">\n<div class=\"panel-heading\">\n<div>\n<h3 class=\"panel-title\">Accessing\/operating drop-downs.<\/h3>\n<\/div>\n<\/div>\n<div class=\"panel-body\">\n<div>\n<p>Just like CheckBox &amp; Radio Buttons, DropDown works almost the same way. Before we can control drop-down boxes, we must import a package &#8216;org.openqa.selenium.support.ui.Select&#8217;. Select is a class which is provided by Selenium to perform multiple operations on DropDown object and Multiple Select object. The object of Select class is created by a &#8216;new&#8217; keyword.<br \/>\nSelect ddSelect = new Select();<\/p>\n<p>Once we have an object of select class, we can access all the methods which resides in the select class. Now lets see a simple code\u00a0 to select a drop-down.<\/p>\n<pre class=\"brush:java\">@Test \r\n public void accessDropDown() throws InterruptedException {\r\n   chrome_path = System.getProperty(\"user.dir\") + \"\/chromedriver\";\r\n   System.setProperty(\"webdriver.chrome.driver\", chrome_path);\r\n   driver = new ChromeDriver(); \r\n   driver.manage().window().maximize(); \r\n\/\/ navigate top a url   \r\n   driver.navigate().to(\"https:\/\/192.168.1.164\/registration-form.html\");  \r\n\/\/ creating an oblect of class Select\r\n   SelectddSelect = new Select();\r\n\/\/ here we selectddSelect by it's visible text.\r\n   ddSelect.selectByVisibleText(\"Friend\");\r\n\/\/ closing browser\r\n   driver.close(); \r\n }<\/pre>\n<\/div>\n<p>We have many select methods which can be used to access a drop-down. Some of them are stated below:<\/p>\n<table width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">\n<tbody>\n<tr valign=\"top\">\n<td style=\"text-align: center\" width=\"50%\"><strong>Method<\/strong><\/td>\n<td style=\"text-align: center\" width=\"50%\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"50%\">selectByVisibleText()<br \/>\ndeselectByVisibleText()<br \/>\nExample:<br \/>\nddSelect.selectByVisibleText(\u201cFriends\u201d);<\/td>\n<td width=\"50%\">Selects\/deselects the option form dropdown that contains the exact matching text given in the parameter. (the parameter are case sensitive)<br \/>\n&lt;option&gt;Friends&lt;\/option&gt;<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"50%\">SelectByValue()<br \/>\ndeselectByValue()<br \/>\nExample:<br \/>\nddSelect.selectByValue(\u201cFriends\u201d);<\/td>\n<td width=\"50%\">Selects\/deselects the option whose attribute matches the given parameter. It always looks of the value attribute and matches with that attribute value.<br \/>\n&lt;option value=&#8221;Friend&#8221;&gt;Friend&lt;\/option&gt;<br \/>\n&lt;option value=&#8221;Advert&#8221;&gt;Advert&lt;\/option&gt;<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"50%\">selectByIndex()<br \/>\ndeselectByIndex()<br \/>\nExample:<br \/>\nddSelect.selectByIndex(\u201cFriends\u201d);<\/td>\n<td width=\"50%\">Selects\/deselects the option at the given index(index is given as a parameter).<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"50%\">isMultiple()<br \/>\nExample:<br \/>\nboolean ddMultiple=ddSelect.isMultiple();<\/td>\n<td width=\"50%\">Returns TRUE if the drop-down element allows multiple selection and FALSE if not.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<div class=\"panel panel-primary\">\n<p>Now, from here we would be able to perform operation to fill a form or to access a web page.\u00a0For any doubts feel free to comment, suggestions\/improvements are highly appreciated.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In the previous post, we learnt how to locate elements in webpage using WebDriver. After locating an element, we obviously need\/want to perform some activity\/event on it. The event could be clicking the element, typing something (filling a form) or getting the content present under the element. Now let&#8217;s see some common events which we <a href=\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":94,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4312,3137,4932],"tags":[],"class_list":["post-95506","post","type-post","status-publish","format-standard","hentry","category-automation-testing","category-testing","category-web-testing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Performing Events in Selenium WebDriver (click, sendkeys to element etc)<\/title>\n<meta name=\"description\" content=\"After locating an element, we obviously need\/want to perform some activity\/event on it. The event could be clicking the element, typing something (filling a form) or getting the content present under the element.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Performing Events in Selenium WebDriver (click, sendkeys to element etc)\" \/>\n<meta property=\"og:description\" content=\"After locating an element, we obviously need\/want to perform some activity\/event on it. The event could be clicking the element, typing something (filling a form) or getting the content present under the element.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-07-03T12:00:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-07-04T09:57:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/09\/asseccing_email.jpg\" \/>\n<meta name=\"author\" content=\"Himanshu Chand\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Himanshu Chand\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/\"},\"author\":{\"name\":\"Himanshu Chand\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/08d4d0b31f228925099740afd668b50f\"},\"headline\":\"Performing Events in Selenium WebDriver\",\"datePublished\":\"2018-07-03T12:00:08+00:00\",\"dateModified\":\"2018-07-04T09:57:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/\"},\"wordCount\":893,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/09\/asseccing_email.jpg\",\"articleSection\":[\"Automation testing\",\"Testing\",\"Web testing\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/\",\"url\":\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/\",\"name\":\"Performing Events in Selenium WebDriver (click, sendkeys to element etc)\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/09\/asseccing_email.jpg\",\"datePublished\":\"2018-07-03T12:00:08+00:00\",\"dateModified\":\"2018-07-04T09:57:02+00:00\",\"description\":\"After locating an element, we obviously need\/want to perform some activity\/event on it. The event could be clicking the element, typing something (filling a form) or getting the content present under the element.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#primaryimage\",\"url\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/09\/asseccing_email.jpg\",\"contentUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/09\/asseccing_email.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Performing Events in Selenium WebDriver\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/08d4d0b31f228925099740afd668b50f\",\"name\":\"Himanshu Chand\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/067d10770fdcc86d177164f68eb74b9528397b3a5fbf01970b6f6dfd48c64281?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/067d10770fdcc86d177164f68eb74b9528397b3a5fbf01970b6f6dfd48c64281?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Himanshu Chand\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/himanshu-chand168\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Performing Events in Selenium WebDriver (click, sendkeys to element etc)","description":"After locating an element, we obviously need\/want to perform some activity\/event on it. The event could be clicking the element, typing something (filling a form) or getting the content present under the element.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/","og_locale":"en_US","og_type":"article","og_title":"Performing Events in Selenium WebDriver (click, sendkeys to element etc)","og_description":"After locating an element, we obviously need\/want to perform some activity\/event on it. The event could be clicking the element, typing something (filling a form) or getting the content present under the element.","og_url":"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2018-07-03T12:00:08+00:00","article_modified_time":"2018-07-04T09:57:02+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/09\/asseccing_email.jpg","type":"","width":"","height":""}],"author":"Himanshu Chand","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Himanshu Chand","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/"},"author":{"name":"Himanshu Chand","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/08d4d0b31f228925099740afd668b50f"},"headline":"Performing Events in Selenium WebDriver","datePublished":"2018-07-03T12:00:08+00:00","dateModified":"2018-07-04T09:57:02+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/"},"wordCount":893,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/09\/asseccing_email.jpg","articleSection":["Automation testing","Testing","Web testing"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/","url":"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/","name":"Performing Events in Selenium WebDriver (click, sendkeys to element etc)","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/09\/asseccing_email.jpg","datePublished":"2018-07-03T12:00:08+00:00","dateModified":"2018-07-04T09:57:02+00:00","description":"After locating an element, we obviously need\/want to perform some activity\/event on it. The event could be clicking the element, typing something (filling a form) or getting the content present under the element.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#primaryimage","url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/09\/asseccing_email.jpg","contentUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/09\/asseccing_email.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/performing-events-selenium-webdriver\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Performing Events in Selenium WebDriver"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/08d4d0b31f228925099740afd668b50f","name":"Himanshu Chand","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/067d10770fdcc86d177164f68eb74b9528397b3a5fbf01970b6f6dfd48c64281?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/067d10770fdcc86d177164f68eb74b9528397b3a5fbf01970b6f6dfd48c64281?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Himanshu Chand"},"url":"https:\/\/webkul.com\/blog\/author\/himanshu-chand168\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/95506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/94"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=95506"}],"version-history":[{"count":18,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/95506\/revisions"}],"predecessor-version":[{"id":131573,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/95506\/revisions\/131573"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=95506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=95506"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=95506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}