-8
public class Utilty
{
public DesiredCapabilities nologs()
{
DesiredCapabilities dcap= new DesiredCapabilities();
return dcap;
}
private static WebDriver driver = new FirefoxDriver(dcap)
}
}

i want to use dcap object outside the method nologs but i am unable to do so.how to use dcap object?

heardm
  • 19
  • 2
  • 11
  • Can you at least take the time to format the code? – Justas Mar 22 '17 at 09:33
  • 2
    You want to step back and learn java, before engaging in spring, selenium. Not knowing how to turn a local variable into a **class field**, sorry, you should be doing nothing else but work through those https://docs.oracle.com/javase/tutorial/ tutorials for quite some days. – GhostCat Mar 22 '17 at 09:34
  • do some research before posting here – Spartan Mar 22 '17 at 09:35

1 Answers1

0

Construct an instance of Utility, and then call dcap(). Eg:

public static void main(String... args) {
    DesiredCapabilities capabilities = new Utility ().dcap();
 ...

Or make the dcap method static like your driver method.

James Fry
  • 1,133
  • 1
  • 11
  • 28