Test skips the step
Posted: Tue Nov 26, 2013 11:22 pm
I have a simple function that I call from my test. wDoc is a WebDocument passed as a parameter to the class.
The following code pushes "Add New Client" button, types ClientName in a text box and pushes Save button.
For some reason at runtime Save Button is being missed and test fails. Looks like it trying to press Save before it finishes typing all chars into ClientName_EditBox and Save button is disabled for some time. I wonder why it even jumps to next line before finishing typing client name? "ClientName_EditBox.PressKeys(ClientName);".
Thanks,
Nikolay
public void Add_New_Client(string clientName)
{
WebElement AddClient = wDoc.FindSingle("/dom[@caption='Clients']//div[#'middle-container']/div[2]//a[@innertext='Add Client']");
AddClient.Click(); //Press AddClient button
wDoc.WaitForDocumentLoaded();
WebElement ClientName_EditBox = wDoc.FindSingle("/dom[@caption='Clients']//input[#'Name']");
ClientName_EditBox.PressKeys(ClientName);
WebElement Save_and_Close = wDoc.FindSingle("/dom[@caption='Clients']//a[#'Save']");
Save_and_Close.Click();
wDoc.WaitForDocumentLoaded();
}
The following code pushes "Add New Client" button, types ClientName in a text box and pushes Save button.
For some reason at runtime Save Button is being missed and test fails. Looks like it trying to press Save before it finishes typing all chars into ClientName_EditBox and Save button is disabled for some time. I wonder why it even jumps to next line before finishing typing client name? "ClientName_EditBox.PressKeys(ClientName);".
Thanks,
Nikolay
public void Add_New_Client(string clientName)
{
WebElement AddClient = wDoc.FindSingle("/dom[@caption='Clients']//div[#'middle-container']/div[2]//a[@innertext='Add Client']");
AddClient.Click(); //Press AddClient button
wDoc.WaitForDocumentLoaded();
WebElement ClientName_EditBox = wDoc.FindSingle("/dom[@caption='Clients']//input[#'Name']");
ClientName_EditBox.PressKeys(ClientName);
WebElement Save_and_Close = wDoc.FindSingle("/dom[@caption='Clients']//a[#'Save']");
Save_and_Close.Click();
wDoc.WaitForDocumentLoaded();
}