- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to enter a letter in uppercase in the edit box using Actions in Selenium?
We can enter a letter in upper case in the edit box in Selenium with the help of Actions. In order to achieve this, we need to first move to the edit box, then click() on that field. Then press SHIFT and enter the letters using sendKeys() method. Finally use build().perform() to execute all the steps.
Example
import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.interactions.Action; import org.openqa.selenium.interactions.Actions; import java.util.concurrent.TimeUnit; public class UpperCase{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); String url = "https://www.tutorialspoint.com/questions/index.php"; driver.get(url); driver.manage().timeouts().implicitlyWait(12, TimeUnit.SECONDS); // move to the element, press shift and then enter the letters then //perform() to execute the action Actions a = new Actions(driver); a.moveToElement(driver.findElement(By.xpath(“input[@type=’text’]))). click().keyDown(Keys.SHIFT).sendKeys(“tutorialspoint”). build().perform(); driver.quit(); } }
- Related Articles
- How to press ENTER inside an edit box in Selenium?
- How do you enter text in the edit box in Selenium?
- How to enter values in an edit box in Selenium with python?
- How to get the value of the edit box in Selenium?
- How to reset or clear an edit box in Selenium?
- How to capture tooltip in Selenium using Actions Class?
- How to input letters in capital letters in an edit box in Selenium with python?
- How to scroll up/down a page using Actions class in Selenium?
- How to test if a letter in a string is uppercase or lowercase using javascript?
- What are the Actions class in Selenium?
- How to edit a JavaScript alert box title?
- Make first letter of a string uppercase in JavaScript?
- First uppercase letter in a string (Iterative and Recursive) in C++
- How to specify "ENTER" button functionality in Selenium WebDriver code?
- How to input text in the text box without calling the sendKeys() using Selenium?

Advertisements