I am new to Selenium. I just want to send keys to a username text box and send a tab key both at a time so that text box can check for availability of username.
Here is the code:
driver.findElement(By.xpath("//label[text()='User Name:']/following::div/input")).sendKeys("UserName");
driver.findElement(By.xpath("//label[text()='User Name:']/following::div/input")).sendKeys(Keys.TAB);
But this one is not working.
driver. findElement(By. xpath(".//div/input[starts-with(@id,'4') and @class=' input' and @type='text' and @placeholder='']")). sendKeys("text");
This implementation of the sendKeys() method sends a sequence of characters/keys to a specific web element, which passes as the first parameter to the method.
Yes, use javascript executer.
I doubt for Keys.TAB
in sendKeys
method... if you want to use TAB you need to do something like below:
Actions builder = new Actions(driver);
builder.keyDown(Keys.TAB).perform()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With