WebDriverWait Constructor Arguments

124 views
Skip to first unread message

Debanjan Bhattacharjee

unread,
Oct 26, 2017, 10:30:21 AM10/26/17
to webdriver
Hello All,

As per the documentation, the `WebDriverWait` API is defined as 

public WebDriverWait(WebDriver driver, long timeOutInSeconds)

Even Eclipse IDE shows the same as follows:

org.openqa.selenium.support.ui.WebDriverWait.WebDriverWait(WebDriver driver, long timeOutInSeconds)
A small test on the Java Primitive Data Type is as follows:

public class Min_Max_Primitive_Data_Types 
{
public static void main(String[] args) 
{
    System.out.println("Integer.MIN = " + Integer.MIN_VALUE);
    System.out.println("Integer.MAX = " + Integer.MAX_VALUE);
    System.out.println("Long.MIN = " + Long.MIN_VALUE);
    System.out.println("Long.MAX = " + Long.MAX_VALUE);
}
}
The output reveals:

Integer.MIN = -2147483648
Integer.MAX = 2147483647
Long.MIN = -9223372036854775808
Long.MAX = 9223372036854775807
Now configuring :

WebDriverWait wait2 = new WebDriverWait(driver, 9223372036854775807);
Eclipse IDE showing error as :

The literal 9223372036854775807 of type int is out of range
Where am I wrong?

Any suggestion and pointers will be helpful.

Thanks and Regards
Dev

darrell grainger

unread,
Oct 27, 2017, 12:30:04 PM10/27/17
to webdriver
When you type a number in Java it will default to being an int. If you want Java to know you REALLY did mean a long you have to add a L at the end. Therefore you need 9223372036854775807L.

Debanjan Bhattacharjee

unread,
Jan 18, 2018, 9:44:56 AM1/18/18
to webdriver
Thanks a lot, @darrell. Your suggestion worked like a charm.

Regards
Debanjan-B
Reply all
Reply to author
Forward
0 new messages