Java 在selenium上测试chromedriver时出现堆栈溢出错误
无法为chrome实例化webdriver实例。 获取堆栈溢出错误 清单1-使用chromedriver 清单2-Chrome驱动程序服务。 在这两种情况下,都会出现stackoverflow异常Java 在selenium上测试chromedriver时出现堆栈溢出错误,java,json,selenium,selenium-chromedriver,Java,Json,Selenium,Selenium Chromedriver,无法为chrome实例化webdriver实例。 获取堆栈溢出错误 清单1-使用chromedriver 清单2-Chrome驱动程序服务。 在这两种情况下,都会出现stackoverflow异常 Exception in thread "main" java.lang.StackOverflowError at java.lang.ReflectiveOperationException.<init>(Unknown Source) at java.lang.ref
Exception in thread "main" java.lang.StackOverflowError
at java.lang.ReflectiveOperationException.<init>(Unknown Source)
at java.lang.reflect.InvocationTargetException.<init>(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.json.JSONObject.populateMap(JSONObject.java:988)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)
线程“main”java.lang.StackOverflower中出现异常
位于java.lang.ReflectiveOperationException。(未知源)
位于java.lang.reflect.InvocationTargetException。(未知源)
在sun.reflect.GeneratedMethodAccessor1.invoke处(未知源)
在sun.reflect.DelegatingMethodAccessorImpl.invoke处(未知源)
位于java.lang.reflect.Method.invoke(未知源)
位于org.json.JSONObject.populateMap(JSONObject.java:988)
位于org.json.JSONObject(JSONObject.java:272)
位于org.json.JSONObject.wrap(JSONObject.java:1587)
位于org.json.JSONObject.populateMap(JSONObject.java:990)
位于org.json.JSONObject(JSONObject.java:272)
位于org.json.JSONObject.wrap(JSONObject.java:1587)
位于org.json.JSONObject.populateMap(JSONObject.java:990)
位于org.json.JSONObject(JSONObject.java:272)
位于org.json.JSONObject.wrap(JSONObject.java:1587)
位于org.json.JSONObject.populateMap(JSONObject.java:990)
位于org.json.JSONObject(JSONObject.java:272)
位于org.json.JSONObject.wrap(JSONObject.java:1587)
位于org.json.JSONObject.populateMap(JSONObject.java:990)
位于org.json.JSONObject(JSONObject.java:272)
位于org.json.JSONObject.wrap(JSONObject.java:1587)
位于org.json.JSONObject.populateMap(JSONObject.java:990)
位于org.json.JSONObject(JSONObject.java:272)
位于org.json.JSONObject.wrap(JSONObject.java:1587)
位于org.json.JSONObject.populateMap(JSONObject.java:990)
位于org.json.JSONObject(JSONObject.java:272)
位于org.json.JSONObject.wrap(JSONObject.java:1587)
位于org.json.JSONObject.populateMap(JSONObject.java:990)
位于org.json.JSONObject(JSONObject.java:272)
位于org.json.JSONObject.wrap(JSONObject.java:1587)
位于org.json.JSONObject.populateMap(JSONObject.java:990)
我正在使用java2s.com中的java-json.jar。
我没有找到任何java-json.jar
下面列出了我正在使用的一些jar版本。
所有JAR都已手动添加到java构建路径中
- selenium-api-3.4.0.jar
- selenium-chrome-driver-3.0.0.jar
- 硒-common-2.0b1.jar
- selenium-remote-common-2.0b1.jar
- selenium-remote-driver-3.4.0.jar
- selenium-support-3.4.0.jar
org.json.JSONObject
中重复的三行之后的所有内容)?@Luke最后三行在org.json.JSONObject.(JSONObject.java:272)org.json.JSONObject.wrap(JSONObject.java:1587)中一直重复在org.json.JSONObject.populateMap(JSONObject.java:990)上,我也有同样的问题。你有没有找到解决方案?是否可以编辑你的问题,将stacktrace的“底部”包括在内(即,org.json.JSONObject
中重复的三行之后的所有内容)最后三行在org.json.JSONObject(JSONObject.java:272)org.json.JSONObject.wrap(JSONObject.java:1587)org.json.JSONObject.populateMap(JSONObject.java:990)重复。我也有同样的问题,你找到解决方案了吗?
import java.io.File;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;
service = new ChromeDriverService.Builder()
.usingDriverExecutable(new File("E:/selenium/chromedriver_win32/chromedriver.exe"))
.usingPort(9515)
.build();
service.start();
driver = new RemoteWebDriver(service.getUrl(),
DesiredCapabilities.chrome());
Exception in thread "main" java.lang.StackOverflowError
at java.lang.ReflectiveOperationException.<init>(Unknown Source)
at java.lang.reflect.InvocationTargetException.<init>(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.json.JSONObject.populateMap(JSONObject.java:988)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)
at org.json.JSONObject.<init>(JSONObject.java:272)
at org.json.JSONObject.wrap(JSONObject.java:1587)
at org.json.JSONObject.populateMap(JSONObject.java:990)