Issue in a line:Zohohybrid frame work | Selenium Forum
M
Posted on 14/10/2016
Hi Ashish,
I am not able to pass the url in navigate function in below code. Firefox opens and maximizes. But no url is getting passed. But when i copy the line driver.get("http://zoho.com"); in openBrowser function it is opening zoho.com successfully. i am getting below error. please help


CODE:

public class GenericKeywords {

public WebDriver driver;

public void openBrowser(String browserName){
System.out.println("Opening browser--"+browserName);
driver =new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

}
public void navigate(String url){
System.out.println("Navigate to url "+url);
driver.get("http://zoho.com");
}


ERROR:

LoginTest -- openBrowser -- --Mozilla
Opening browser--Mozilla
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
LoginTest -- navigate -- --http://zoho.com
Navigate to url http://zoho.com
Exception in thread "main" java.lang.NullPointerException
at com.qtpselenium.hybrid.util.GenericKeywords.navigate(GenericKeywords.java:22)
at com.qtpselenium.hybrid.util.Keywords.main(Keywords.java:25)

M
Replied on 15/10/2016

send complete exception.


M
Replied on 16/10/2016

Hi Ashish,

Below is the complete exceotion I am getting. driver.get("http://zoho.com") is working correctly in openBrowser function
but not when i write the code driver.get("http://zoho.com")
in navigate function. But the sysytem.out.println function is working in navigate function. not sure why the url is not passing to
firefox when the firefox is opened.



Exception

LoginTest -- openBrowser -- --Mozilla
Opening browser--Mozilla
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
LoginTest -- navigate -- --http://zoho.com
Navigate to url http://zoho.com
Exception in thread "main" java.lang.NullPointerException
at com.qtpselenium.hybrid.util.GenericKeywords.navigate(GenericKeywords.java:22)
at com.qtpselenium.hybrid.util.Keywords.main(Keywords.java:25)


M
Replied on 17/10/2016

can you come on skype?


M
Replied on 17/10/2016

Hi Ashish,

I had come on Skype today 7.15AM PST. But did not get a response from you. Please let me know your convenient time to look into the issue.


M
Replied on 18/10/2016

18 oct 7.15 am pst is fine.


M
Replied on 18/10/2016

Hi Ashish,


My code [b:3sa4p1x7]driver.get("http://zoho.com"); [/b:3sa4p1x7] started working in navigation function when i declared the variable static on top. Is it ok to declare driver as static?

like Public Static Webdriver driver;


M
Replied on 19/10/2016

yes, it is fine. i was going to recommend that next.