• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

Pass WebDriver into a Class - Eclipse/Selenium

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am completely new to automation testing and am fairly inexperienced at programming. I'm trying to design about 50 test cases - with most of them requiring the same block of code (Login to Dynamics NAV). Since I only want to write this block once, I tried to put it in a separate class and call it when needed.

What my program should do: Initialize several variables and open a browser. Then run the code in NAVLogin.java (login) and return.

What my program actually does: Initialize several variables and open a browser. Then open another browser, login and return.

Because I'm struggling to find a way to pass the driver (and other variables) from CUCR01.java into NAVLogin.java, I ended up having to re-initialize everything in NAV Login. I've tried a lot of things so far and would really appreciate if anyone can offer a helping hand.

CUCR01.java (my test case)

NAVLogin.java
 
Is that a spider in your hair? Here, threaten it with this tiny ad:
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic