In this article we will see the functions to control browser timeouts by selenium web driver.

For this, we need to create a TimeSpan object(period of time).
Public TimeSpan myTime = new TimeSpan (Parameter);
We can parametrize it by 4 ways
1. ticks//This is Long Type, 1 ticks =100 nanosecond
2. hours, minutes, seconds//All are Integer type
3. days, hours, minutes, seconds//All are Integer type,
4. days,hours, minutes, seconds,milliseconds//All are Integer type
 I use 3rd, so my code
private TimeSpan myTime = new TimeSpan(2,1,1,5);

-To Specify the amount of time the web driver will wait when searching for an element if it is not immediately present
driver.Manage().Timeouts().ImplicitlyWait(myTime);
Note :  We need to use it carefully as this will increase testing time(spatially with XPath).

-To Specify the amount of time the web driver will wait when executing JavaScript asynchronously.
driver.Manage().Timeouts().SetScriptTimeout(myTime);