• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Chromedriver selenium java

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have this code as shown here that will create a chromedriver that will be available to all instances of the class, and to other objects using the class.
however, as i know that in order to use the chrome driver, i have to include this code here.

if i were to put the codes like that, there will be a error of <identifier> expected illegal start of type in the System.setProperty


and if i were to write it this way, there will be multiple drivers opening based on the number of methods i have.


what would the correct way to implement this if i want to keep the public static final infront of the WebDriver driver?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could use a static initialization block like:



Or you could put the two lines of code in a method and have something like:
 
Cathy Seb
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:You could use a static initialization block like:



this solution works well, thank you!
reply
    Bookmark Topic Watch Topic
  • New Topic