这是我的代码:
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
public class NEwClass2 {
public static void main(String[] args) {
DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://gmail.com");
selenium.start();
selenium.open("/");
}
}
我似乎得到了错误:
“线程中的异常”主“java.lang.RuntimeException:无法启动Selenium会话:”
我不知道为什么。提前感谢您的回答!
objc [6744]:类JavaLaunchHelper在/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/bin/java(0x1002704c0)和/Library/Java/JavaVirtualMachines/jdk1.8.0_151中实现.jdk / Contents / Home / jre / lib / libinstrument.dylib(0x1003384e0)。将使用两者之一。哪一个未定义。 线程“main”中的异常java.lang.RuntimeException:无法启动Selenium会话: var json = Object.freeze('{“version”:“3.6.0”,“type”:“Standalone”,“consoleLink”:“/ wd / hub”}');
<div id="content">
<div id="help-heading">
<h1><span id="logo"></span></h1>
<h2>Selenium <span class="se-type"></span> v.<span class="se-version"></span></h2>
</div>
<div id="content-body">
<p>
Whoops! The URL specified routes to this help page.
</p>
<p>
For more information about Selenium <span class="se-type"></span> please see the
<a class="se-docs">docs</a> and/or visit the <a class="se-wiki">wiki</a>.
<span id="console-item">
Or perhaps you are looking for the Selenium <span class="se-type"></span> <a class="se-console">console</a>.
</span>
</p>
<p>
Happy Testing!
</p>
</div>
<div>
<footer id="help-footer">
Selenium is made possible through the efforts of our open source community, contributions from
these <a href="https://github.com/SeleniumHQ/selenium/blob/master/AUTHORS">people</a>, and our
<a href="http://www.seleniumhq.org/sponsors/">sponsors</a>.
</footer>
</div>
</div>
</body>
</html>
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:109)
at NEwClass2.main(NEwClass2.java:9)
Caused by: com.thoughtworks.selenium.SeleniumException: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="/assets/displayhelpservlet.css" media="all"/>
<link href="/assets/favicon.ico" rel="icon" type="image/x-icon" />
<script src="/assets/jquery-3.1.1.min.js" type="text/javascript"></script>
<script src="/assets/displayhelpservlet.js" type="text/javascript"></script>
<script type="text/javascript">
var json = Object.freeze('{"version":"3.6.0","type":"Standalone","consoleLink":"/wd/hub"}');
</script>
</head>
<body>
<div id="content">
<div id="help-heading">
<h1><span id="logo"></span></h1>
<h2>Selenium <span class="se-type"></span> v.<span class="se-version"></span></h2>
</div>
<div id="content-body">
<p>
Whoops! The URL specified routes to this help page.
</p>
<p>
For more information about Selenium <span class="se-type"></span> please see the
<a class="se-docs">docs</a> and/or visit the <a class="se-wiki">wiki</a>.
<span id="console-item">
Or perhaps you are looking for the Selenium <span class="se-type"></span> <a class="se-console">console</a>.
</span>
</p>
<p>
Happy Testing!
</p>
</div>
<div>
<footer id="help-footer">
Selenium is made possible through the efforts of our open source community, contributions from
these <a href="https://github.com/SeleniumHQ/selenium/blob/master/AUTHORS">people</a>, and our
<a href="http://www.seleniumhq.org/sponsors/">sponsors</a>.
</footer>
</div>
</div>
</body>
</html>
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:109)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:103)
at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:272)
at com.thoughtworks.selenium.HttpCommandProcessor.start(HttpCommandProcessor.java:234)
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:100)
... 1 more
Process finished with exit code 1