The SendKeys method will send characters to any WebElement object to which you called it, in this case a request. Even after moving to the next object, the key to the request element will still be sent. In my experience, using keys (like a tab) to move between items tends to be inconsistent and unreliable. Instead, try something like this:
WebElement userNameField = driver.findElement(By.id("userNameTextBoxId")); WebElement passwordField = driver.findElement(By.id("passwordTextBoxId")); userNameField.sendKeys("myusername"); passwordField.sendKeys("mypassword");
If you do not have identifiers in the text fields, there are several other identifiers that you can use, such as classname and xpath (although I had a bad experience using xpath in selenium - use the identifier when possible).
source share