Hi Guys,
I am new to Java and what I am trying to do is to access an object from one method to another this is my code bellow:
in method changephot i want to use the browser object but it seems the object it returns null value, how can i keep the value of the browser object from the login method and continue using it. thank you guys in advance.public class ClassRc1 extends ConfigClass { public static DefaultSelenium browser; public static void main(String[] args) throws FileNotFoundException, IOException, InterruptedException{ changephoto(); } public static void login() throws FileNotFoundException, IOException, InterruptedException { ConfigClass.connect(); String url=ConfigClass.config.getProperty("url"); String username=ConfigClass.config.getProperty("username"); String password=ConfigClass.config.getProperty("password"); Selenium browser= new DefaultSelenium("localhost",4444 , "*firefox", "http://"+url); browser.start(); browser.open("/"); browser.windowMaximize(); browser.type("//*[@id='email']", username); browser.type("//*[@id='pass']", password); } public static void changephoto() throws FileNotFoundException, IOException, InterruptedException{ login(); browser.click("//*[@id='u_0_f']"); /* this line return null,ue of th how can i continue using the browser object from the previous method */ } }