how to override implicitlywait() while doing try catch in Selenium Webdriver?

I have a framework where I have written implicitlywait() in superTESTNG class and all other sub class extends superTESTNG. In many of my sub classes I have try catch. The problem I am facing is due to this implicitlywait().

The sub class try catch is taking too much time to execute. Please suggest a solution so that it will not wait during try catch.

This is my code:

in supertestNG

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

in subclass

try
{
    ProjectLibrary.SelectPreviousRecord(xlpath, sheetName, 2, 1);
}
catch (NoSuchElementException ex)
{
    ProjectLibrary.SelectPreviousRecord(xlpath, sheetName, 2, 2);
}

try
{
    ProjectLibrary.CompareStringTextByID(xlpath, sheetName, 2, 1, "Name","ctl00_ContentPlaceHolder1_txtName");
}
catch (NoSuchElementException ex)
{
    ProjectLibrary.CompareStringTextByID(xlpath, sheetName, 2, 2, "Name", "ctl00_ContentPlaceHolder1_txtName");
}

Answers


try
{
driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
ProjectLibrary.SelectPreviousRecord(xlpath, sheetName, 2, 1);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
catch (NoSuchElementException ex)
{
ProjectLibrary.SelectPreviousRecord(xlpath, sheetName, 2, 2);
}

try
{
driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
ProjectLibrary.CompareStringTextByID(xlpath, sheetName, 2, 1, "Name","ctl00_ContentPlaceHolder1_txtName");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
catch (NoSuchElementException ex)
{
ProjectLibrary.CompareStringTextByID(xlpath, sheetName, 2, 2, "Name", "ctl00_ContentPlaceHolder1_txtName");
}

Need Your Help

Using MD5 in C# and SQL Server 2008 R2

c# sql-server hash sql-server-2008-r2 md5

I'm using to hash a password using MD5 programatically, but when i compared MD5 hashes created in C# and MD5 hashes created by an SQL Server ( HASHBYTES('MD5', 'admin') ) the result is not same.

Calling MS Sql server stored procedure which has cursor and temporal table in it from java?

java sql-server-2008 stored-procedures jdbc

I have one stored proc written in MS Sql Server which has cursor and temporal table in it and returns result of one select query at the end.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.