Java code throws exception after adding Selenium-java-2.31.0 library in Maven -
i working on netbeans. added library selenium-java-2.31.0. shows exception. added libraries on library dependent.
i follow link add library in netbeans.
my code :-
import org.jsoup.jsoup; import org.jsoup.nodes.document; import org.jsoup.nodes.element; import org.jsoup.select.elements; import java.io.ioexception; import java.net.uri; import java.net.urisyntaxexception; import java.util.iterator; import org.openqa.selenium.by; import org.openqa.selenium.webdriver; import org.openqa.selenium.firefox.firefoxdriver; public static void main(string[] args) throws ioexception, urisyntaxexception { string url1 = "http://www.jabong.com/giordano-p6868-black-analog-watch-183702.html"; document doc1 = jsoup.connect(url1).get(); webdriver driver = new firefoxdriver(); driver.get(url1); elements tag_list = doc1.getallelements(); for( element tag1 : tag_list ) { point point=driver.findelement(by.id(tag1.id())).getlocation(); system.out.println("x position : " + point.x); system.out.println("y position : " + point.y); } }
exception
exception in thread "main" java.lang.noclassdeffounderror: com/google/common/base/function @ template_matching.template_matching.main(template_matching.java:275) caused by: java.lang.classnotfoundexception: com.google.common.base.function @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:423) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:356) ... 1 more java result: 1 build successful (total time: 2 seconds)
help me in solving problem. why exception throws?
edit no. 1
exception in thread "main" java.lang.noclassdeffounderror: org/json/jsonexception @ org.openqa.selenium.firefox.firefoxprofile.<init>(firefoxprofile.java:89) @ org.openqa.selenium.firefox.firefoxprofile.<init>(firefoxprofile.java:79) @ org.openqa.selenium.firefox.firefoxprofile.<init>(firefoxprofile.java:67) @ org.openqa.selenium.firefox.firefoxdriver.getprofile(firefoxdriver.java:260) @ org.openqa.selenium.firefox.firefoxdriver.startclient(firefoxdriver.java:236) @ org.openqa.selenium.remote.remotewebdriver.<init>(remotewebdriver.java:110) @ org.openqa.selenium.firefox.firefoxdriver.<init>(firefoxdriver.java:190) @ org.openqa.selenium.firefox.firefoxdriver.<init>(firefoxdriver.java:183) @ org.openqa.selenium.firefox.firefoxdriver.<init>(firefoxdriver.java:179) @ org.openqa.selenium.firefox.firefoxdriver.<init>(firefoxdriver.java:92) @ template_matching.template_matching.main(template_matching.java:275) caused by: java.lang.classnotfoundexception: org.json.jsonexception @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:423) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:356) ... 11 more java result: 1
edit no.2
now moved maven, thinking downloads dependent libraries. shows diffrerent error.
edit no. 3
as shows problem firefox, replaced firefox chrome. time previous error removed. new comes in picture. please see this.
edit no. 4
edit no. 5
now shifted firefox again, , gets given page, stucks then. why ?
below error snapshot got.
i believe problem seeing @ point due passing in driver.get("url1");
i think mean passing in driver.get(url1); (notice no quotation marks)
to expand on little bit, reason throwing malformed uri exception uri being passed in (url1) not contain protocol (http/https).
Comments
Post a Comment