Need to call webelement class from another class

369 views
Skip to first unread message

Harish Dhage

unread,
Jan 13, 2015, 7:22:32 AM1/13/15
to seleniu...@googlegroups.com
public class ReusableClass {
public static WebDriver drive;
public static String genCertificate = "Certificate Error: Navigation Blocked";
public static void navigateBedSetup() throws InterruptedException{
System.out.println("2");
Thread.sleep(10);
//here I am not able to call below statement
WebElement element = drive.findElement(By.linkText("Admin Setup"));
System.out.println("3");
Actions act = new Actions(drive);
act.moveToElement(element).perform();
drive.findElement(By.linkText("Bed Setup")).click();
System.out.println("4");
Thread.sleep(10);
}
}


public class SearchBed extends LoginLogout{
  @Test
  public void searchBedByUnit() throws InterruptedException {
 ReusableClass.navigateBedSetup();
 System.out.println("5");
 drive.findElement(By.id("btn_create_Bed")).click();
 Thread.sleep(10);
 System.out.println("6");
  }
}

Please help me, so that how can I address this issue

Harish Dhage

unread,
Jan 13, 2015, 7:53:56 AM1/13/15
to seleniu...@googlegroups.com
Also I am getting NullPoiterException for above script. I am using latest webrdriver - 2.41 and ie driver 2.39

Ashish b lal

unread,
Jan 13, 2015, 8:11:35 AM1/13/15
to seleniu...@googlegroups.com
WebElement element = drive.findElement(By.linkText(
"Admin Setup"));


Its should be driver

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/30313b0f-47a6-4a01-8d51-2949f001321a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Hope to hear soon from you.
    
Thanks & Regards,
Ashish.B.LAL

Harish Dhage

unread,
Jan 13, 2015, 8:42:41 AM1/13/15
to seleniu...@googlegroups.com
I haven't get u @Ashish

Krishnan Mahadevan

unread,
Jan 13, 2015, 11:38:09 AM1/13/15
to Selenium Users
Where exactly are you instantiating your WebDriver ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Tue, Jan 13, 2015 at 5:52 PM, Harish Dhage <harish....@gmail.com> wrote:

--

Harish Dhage

unread,
Jan 13, 2015, 1:52:59 PM1/13/15
to seleniu...@googlegroups.com
I am instantiating WebDriver from another login class

Krishnan Mahadevan

unread,
Jan 13, 2015, 9:37:22 PM1/13/15
to Selenium Users

If you need help you are expected to add as much context as possible. Answering in bits and pieces aren't going to help you get anywhere with your query.

So let's start again.

1. What is your issue ?
2. What does your code look like ? Share a example which can be run by anyone and simulate the problem. This means you have to show us the relevant sections of everything.
3. What does your complete stacktrace look like ?

Reply all
Reply to author
Forward
0 new messages