Trying to do something simple - I have a set of statements to clear browser cookies:
public void clearCookies () {
selenium.open("http://www.myurl.com");
selenium.waitForPageToLoad("10000");
selenium.deleteAllVisibleCookies();
}
Now, if I use this function in a test script (using TestNG), calls to this work perfectly. However, if I moved this function to a separate class and change the declaration to include "static", the "selenium" keyword is not recognized.
In a configuration class (say configClass),
public static void clearCookies () {
selenium.open("http://www.myurl.com");
selenium.waitForPageToLoad("30000");
selenium.deleteAllVisibleCookies();
}
Now, in my test script, if I call configClass.clearCookies();
, I get a runtime error
I tried declaring DefaultSelenium selenium = new DefaultSelenium(null);
, in the clearCookies() function, but that too results in a runtime error.
I do have the import com.thoughtworks.selenium.*;
import in my configClass.
Any pointers would be appreciated. Thanks.