Test Case does not execute fully

Hi,
First of all thanks for such a nice and detailed tutorial on Selenium. I used your approach on Selenium Hybrid framework in exactly the same manner. But I am facing the below issue intermittently while executing my Test Case :

For example: I have 10 Test Steps written for a test case in DataEngine.xls. When I try to run it sometimes its executing all 10 steps, sometimes its executing 2 steps only and sometimes its executing 3 Steps. And if I see the logs it does not give any error like NoSuchElement found. It just ends the test like if there are no steps after those.Please suggest.

I have also put explicit wait conditions for an elements also , below is the function for click keyword function for your reference :


public static void click(String object, String data){

try{

wait = new WebDriverWait(driver,50);

wait.until(ExpectedConditions.elementToBeClickable(By.xpath(OR.getProperty(object))));

System.out.println("Clicking on Webelement "+ object);

Log.info("Clicking on Webelement "+ object);

driver.findElement(By.xpath(OR.getProperty(object))).click();

}catch(Exception e){

System.out.println("Not able to click --- " + object + e.getMessage());

Log.error("Not able to click --- " + object + e.getMessage());

DriverScript.bResult = false;

}

}

Here is what I see in Logs :
When It executed 3 Steps :
2014-11-21 12:01:54,649 INFO  [Log] ****************************************************************************************
2014-11-21 12:01:54,649 INFO  [Log] Opening Browser
2014-11-21 12:02:15,169 INFO  [Log] Firefox browser started
2014-11-21 12:02:16,105 INFO  [Log] Navigating to URL
2014-11-21 12:02:20,375 INFO  [Log] Entering the text in tbx_UserName
2014-11-21 12:02:21,068 INFO  [Log] Entering the text in tbx_Password
2014-11-21 12:02:22,229 INFO  [Log] Clicking on Webelement btn_LogIn
2014-11-21 12:02:22,731 INFO  [Log] XXXXXXXXXXXXXXXXXXXXXXX             -E—N—D-             XXXXXXXXXXXXXXXXXXXXXX

When It executed just 2 Steps and didn’t clicked Login :
************************
2014-11-21 12:04:57,106 INFO  [Log] ****************************************************************************************
2014-11-21 12:04:57,106 INFO  [Log] Opening Browser
2014-11-21 12:05:09,498 INFO  [Log] Firefox browser started
2014-11-21 12:05:09,873 INFO  [Log] Navigating to URL
2014-11-21 12:05:13,884 INFO  [Log] Entering the text in tbx_UserName
2014-11-21 12:05:14,711 INFO  [Log] Entering the text in tbx_Password
2014-11-21 12:05:15,132 INFO  [Log] XXXXXXXXXXXXXXXXXXXXXXX             -E—N—D-             XXXXXXXXXXXXXXXXXXXXXX

Default Asked on November 21, 2014 in Selenium WebDriver.
Add Comment
  • 2 Answer(s)

    Hi friend,

    Your question suggests towards “Login Button” Please try to locate the element/ object for this and do action on it. Your ErrorLogMessage shows the details

    Train Answered on November 24, 2014.
    Add Comment

    Hi,

    Not sure of the issue but it seems to be a element loading issue to me and I know sometimes Selenium reacts weirdly. The best way to catch the issue is to give selenium enough time to think and wor..Try using thread.sleep() after every action and see if it works fine or better than before. If it does, then you got the issue and sync all your actions with using waits smartly.

    Regards,
    Lakshay Sharma

    Professor Answered on November 24, 2014.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.