0

量角器版本:5.1.2 Safari 版本:10.1.2

我已从 Safari 启用“允许远程自动化”-> 开发并使用以下命令从 cmd 启动 safari 驱动程序:/usr/bin/safaridriver -p 8844

现在,尝试使用 protractor conf.js 运行量角器测试。测试无法以以下日志开始:

Build info: version: '3.5.1', revision: '9c21bb67ef', time: '2017-08-16T21:10:06.092Z'

System info: host: 'dyn-49-127-9-116.its.monash.edu.au', ip: 'fe80:0:0:0:479:1a15:751b:51d6%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_144'

Driver info: driver.version: unknown
[15:28:40] E/launcher - SessionNotCreatedError: Could not create a session: You must enable the 'Allow Remote Automation' option in Safari's Develop menu to control Safari via WebDriver. (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 32 milliseconds

Build info: version: '3.5.1', revision: '9c21bb67ef', time: '2017-08-16T21:10:06.092Z'

System info: host: 'dyn-49-127-9-116.its.monash.edu.au', ip: 'fe80:0:0:0:479:1a15:751b:51d6%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_144'

Driver info: driver.version: unknown

    at WebDriverError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:5)

    at SessionNotCreatedError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:214:5)

    at Object.checkLegacyResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:505:15)

    at parseHttpResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:509:13)

    at doSend.then.response (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:440:13)

    at process._tickCallback (internal/process/next_tick.js:109:7)

From: Task: WebDriver.createSession()

    at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:777:24)

    at createDriver (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/index.js:167:33)

    at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/index.js:632:14)

    at Hosted.getNewDriver (/usr/local/lib/node_modules/protractor/lib/driverProviders/driverProvider.ts:60:29)

    at Runner.createBrowser (/usr/local/lib/node_modules/protractor/lib/runner.ts:225:39)

    at q.then.then (/usr/local/lib/node_modules/protractor/lib/runner.ts:391:27)

    at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:834:54)

    at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:863:30)

    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:796:13)

    at /usr/local/lib/node_modules/protractor/node_modules/q/q.js:556:49

[15:28:40] E/launcher - Process exited with error code 19
4

2 回答 2

1

我弄清楚了这个问题。由于内置 safari 驱动程序一次只能有一个浏览器窗口,因此我退出了所有正在运行的 safari 窗口并再次运行测试。工作得很好:)

参考: https ://webkit.org/blog/6900/webdriver-support-in-safari-10/

于 2017-08-18T06:43:10.140 回答
0

有点棘手,因为目前由于 webdriver/selenium 不兼容而无法正常工作。我们希望,在新的 webdriver 版本中,它能够正常工作。见这里

于 2017-08-18T06:09:02.873 回答