1

我已经创建了脚本,即小脚本需要打开谷歌网站,就是这样。

这适用于 Firefox、google-chrome。但不是与野生动物园。为什么?

实际上它正在启动 safari 浏览器,但它没有运行[未打开 URL]。不知道为什么?

操作系统:Mac OS X 10.12.3 x86_64

Selenium 版本:selenium-server-standalone-2.53.1.jar

浏览器:safari

重现步骤 这是我使用的代码

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://www.google.co.in/" />
<title>test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">test</td></tr>
</thead><tbody>
<tr>
        <td>open</td>
        <td>/?gfe_rd=cr&amp;ei=4EXnWLyLOdiAoAOQrofAAw</td>
        <td></td>
</tr>
<tr>
        <td>click</td>
        <td>id=lst-ib</td>
        <td></td>
</tr>
<tr>
        <td>type</td>
        <td>id=lst-ib</td>
        <td>check safari browser</td>
</tr>
<tr>
        <td>click</td>
        <td>name=btnK</td>
        <td></td>
</tr>

</tbody></table>
</body>
</html>

我执行的这段代码(运行)

java -jar selenium-server-standalone-2.53.1.jar -htmlsuite "*safari" "https://www.google.com" "test_suite.html" "result_safari.html"

这是我得到的错误

19:50:20.287 INFO - Launching a standalone Selenium Server
19:50:20.341 INFO - Java: Oracle Corporation 25.77-b03
19:50:20.341 INFO - OS: Mac OS X 10.12.3 x86_64
19:50:20.367 INFO - v2.53.1, with Core v2.53.1. Built from revision a36b8b1
19:50:20.464 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC
19:50:20.465 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC
19:50:20.465 INFO - Driver class not found: com.opera.core.systems.OperaDriver
19:50:20.465 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
19:50:20.468 INFO - Driver class not found: org.openqa.selenium.htmlunit.HtmlUnitDriver
19:50:20.468 INFO - Driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver is not registered
jar:file:/Users/<userName>/Downloads/test/selenium-server-standalone-2.53.1.jar!/core
19:50:20.673 INFO - Launching Safari to visit 'file:/var/folders/p0/_vchgbcj10ddvy8h9gtyvxs00000gn/T/customProfileDir220575/core/RemoteRunner.html?auto=true&multiWindow=true&defaultLogLevel=info&baseUrl=https%3A%2F%2Fwww.google.com&resultsUrl=../postResults&test=https%3A%2F%2Fwww.google.com%2Fselenium-server%2Ftests%2Ftest_suite.html&driverUrl=http://localhost:4444/selenium-server/driver/' via '/var/folders/p0/_vchgbcj10ddvy8h9gtyvxs00000gn/T/customProfileDir220575/redirect_to_go_to_selenium.htm'...
19:50:24.964 WARN - POST /selenium-server/driver/?seleniumStart=true&localFrameAddress=top&seleniumWindowName=&uniqueId=sel_75180&counterToMakeURsUniqueAndSoStopPageCachingInTheBrowser=1492093224878&sequenceNumber=0 HTTP/1.1
java.lang.NullPointerException: sessionId should not be null; has this session been started yet?
    at org.openqa.selenium.server.FrameGroupCommandQueueSet.getQueueSet(FrameGroupCommandQueueSet.java:220)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleBrowserResponse(SeleniumDriverResourceHandler.java:186)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:152)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
    at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
    at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
    at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
    at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
    at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
    at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
    at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
19:50:27.244 WARN - POST /selenium-server/driver/?seleniumStart=true&localFrameAddress=top&seleniumWindowName=&uniqueId=sel_75180&counterToMakeURsUniqueAndSoStopPageCachingInTheBrowser=1492093227216&sequenceNumber=1 HTTP/1.1
java.lang.NullPointerException: sessionId should not be null; has this session been started yet?
    at org.openqa.selenium.server.FrameGroupCommandQueueSet.getQueueSet(FrameGroupCommandQueueSet.java:220)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleBrowserResponse(SeleniumDriverResourceHandler.java:186)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:152)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
    at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
    at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
    at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
    at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
    at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
    at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
    at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
19:50:30.308 WARN - POST /selenium-server/driver/?seleniumStart=true&localFrameAddress=top&seleniumWindowName=&uniqueId=sel_75180&counterToMakeURsUniqueAndSoStopPageCachingInTheBrowser=1492093230216&sequenceNumber=2 HTTP/1.1
java.lang.NullPointerException: sessionId should not be null; has this session been started yet?
    at org.openqa.selenium.server.FrameGroupCommandQueueSet.getQueueSet(FrameGroupCommandQueueSet.java:220)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleBrowserResponse(SeleniumDriverResourceHandler.java:186)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:152)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
    at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
    at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
    at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
    at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
    at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
    at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
    at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
19:52:04.079 WARN - POST /selenium-server/driver/?seleniumStart=true&localFrameAddress=top&seleniumWindowName=&uniqueId=sel_75180&counterToMakeURsUniqueAndSoStopPageCachingInTheBrowser=1492093324049&sequenceNumber=3 HTTP/1.1
java.lang.NullPointerException: sessionId should not be null; has this session been started yet?
    at org.openqa.selenium.server.FrameGroupCommandQueueSet.getQueueSet(FrameGroupCommandQueueSet.java:220)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleBrowserResponse(SeleniumDriverResourceHandler.java:186)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:152)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
    at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
    at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
    at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
    at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
    at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
    at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
    at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
19:52:36.818 WARN - POST /selenium-server/driver/?seleniumStart=true&localFrameAddress=top&seleniumWindowName=&uniqueId=sel_75180&counterToMakeURsUniqueAndSoStopPageCachingInTheBrowser=1492093356812&sequenceNumber=4 HTTP/1.1
java.lang.NullPointerException: sessionId should not be null; has this session been started yet?
    at org.openqa.selenium.server.FrameGroupCommandQueueSet.getQueueSet(FrameGroupCommandQueueSet.java:220)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleBrowserResponse(SeleniumDriverResourceHandler.java:186)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:152)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
    at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
    at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
    at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
    at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
    at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
    at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
    at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)

相同的代码在 Firefox 中运行,在 mac 中运行 chrome。但不是在 Safari 中。

这有什么问题?

我怎么能跑?

4

0 回答 0