- ArthurActive particpant
- Posts : 23
Join date : 2011-05-23
Location : Pune
How to call selenium library function in suite.
Tue Jul 26, 2011 6:41 pm
Hi,
I have written a library in java which has all the tests of selenium in library I have not called setUp().
The setup is in suite file where i have written code to call multiple tests from library in one function.
The call goes to the library and then the "java.lang.NullPointerException" comes.
Folloeing is my code
Library.java
public class Library extends SeleneseTestCase
{
public int Login() throws Exception
{
if (selenium.isElementPresent("companyID"))
{
selenium.type("companyID", "COMP");
selenium.click("submit_logon");
selenium.waitForPageToLoad("80000");
}
}
}
Login.java
public class Login extends Library {
@Before
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "https://businessbanking.com/");
selenium.start();
}
public void testAllTests() throws Exception
{
Library obj1 = new Library();
obj1.Login();
}
}
Should i pass something in obj1.Login(); as parameter but what?
Is there any other way to solve my problem of calling function?
As per my observation selenium instance started on login file is not addressed to Library. I tried to pass "selenium" as parameter but failed, in Library i tried "super.setUp()" it also failed.
Please help me Regarding the Issue.
Thanks in Advance.
I have written a library in java which has all the tests of selenium in library I have not called setUp().
The setup is in suite file where i have written code to call multiple tests from library in one function.
The call goes to the library and then the "java.lang.NullPointerException" comes.
Folloeing is my code
Library.java
public class Library extends SeleneseTestCase
{
public int Login() throws Exception
{
if (selenium.isElementPresent("companyID"))
{
selenium.type("companyID", "COMP");
selenium.click("submit_logon");
selenium.waitForPageToLoad("80000");
}
}
}
Login.java
public class Login extends Library {
@Before
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "https://businessbanking.com/");
selenium.start();
}
public void testAllTests() throws Exception
{
Library obj1 = new Library();
obj1.Login();
}
}
Should i pass something in obj1.Login(); as parameter but what?
Is there any other way to solve my problem of calling function?
As per my observation selenium instance started on login file is not addressed to Library. I tried to pass "selenium" as parameter but failed, in Library i tried "super.setUp()" it also failed.
Please help me Regarding the Issue.
Thanks in Advance.
- ArthurActive particpant
- Posts : 23
Join date : 2011-05-23
Location : Pune
Re: How to call selenium library function in suite.
Thu Jul 28, 2011 6:55 pm
Instead of obj1 write super
Permissions in this forum:
You cannot reply to topics in this forum