We are using type() function to type inside html inputs. The form has multiple text inputs and we need to write into all of them. When we run tests automatically in TeamCity, they fail, because Selenium has to fill all of them, but it fills 2 values meant for 2 different inputs into one input. It means that it did not switch to second input field, but typed that twice into the same input.
Is it know bug? Could it be fixed by setting any delay before type()?
private void fillItemDataToEditor(BigDecimal quantity, String artNo) {
By xPathToEditor = By.xpath("//div[@id='editInvoiceItem']//*[@id='vatPerc']");
waitForAjaxElement(xPathToEditor);
waitForAjaxElement(By.xpath("//input[@id='quantity']"));
if (quantity != null) {
waitForAjaxElement(By.xpath("//input[@id='quantity']"));
type(By.xpath("//input[@id='quantity']"), quantity);
}
if (artNo != null) {
waitForAjaxElement(By.xpath("//input[@id='articleNo']"));
type(By.xpath("//input[@id='articleNo']"), artNo);
}
click(By.xpath(OK_BUTTON_XPATH));
waitForAjaxElementDisappear(xPathToEditor);
}
The function actually contains a bit more inputs, however, it should be enough. Those waitForAjaxElement are used because the form is displayed as a modal window, so we thought that it might be the issue.
Aucun commentaire:
Enregistrer un commentaire