I have a simple method for sending keys to a textbox, but sometimes the end letters are missing, or the whole text, yet selenium returns 'Passed' for this test step. This happens only in a specific dialog window which has 4 elements: 1. Select 2. Input text 3. Save button 4. Cancel button
The test case selects a value from the select list, then types the given string to the textbox and clicks save.
Can I somehow verify right after the text is typed that it equals to the expected text? I tried with textboxelement.getText() but it returned null, probably because the cursor was still in the textbox and the text was not sent. I'd like to solve it without pressing a key like ENTER because it might close this dialog window.
My send text method:
public final void sendText(final String value, final String id) {
final By locator = By.id(textOrVariableValue(id));
final WebElement element = getElementByLocator(locator, ExpectedConditions.elementToBeClickable(locator), 10, true);
element.clear();
element.sendKeys(textOrVariableValue(value));
}
Thanks in advance!
text boxwhere you trying to add text?