小编bum*_*mbu的帖子

远程调试在selenium chromedriver上运行的Internjs

我尝试远程调试Internjs运行的测试.基本上它是由Selenium和Chromedriver运行的Chrome.

我将Chromedriver debuggerAddress选项设置为

debuggerAddress: '127.0.0.1:8765'
Run Code Online (Sandbox Code Playgroud)

现在,当我运行测试时,Selenium会等待一段时间而不是失败并显示消息:

FATAL ERROR
UnknownError: [POST http://localhost:4444/wd/hub/session / {"desiredCapabilities":{"browserName":"chrome","name":"tests/intern_local","idle-timeout":60,"selenium-version":"2.44.0","chromeOptions":{"debuggerAddress":"127.0.0.1:8765"}}}] unknown error: cannot connect to chrome at 127.0.0.1:8765
from chrome not reachable
  (Driver info: chromedriver=2.12.301326 (093c7e07b4a916b690e784b0374c7f618f1ea4be),platform=Mac OS X 10.10.1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.64 seconds
Run Code Online (Sandbox Code Playgroud)

我不知道我必须做什么才能将chrome连接到服务器.

我试过了:

  • 在该端口上运行chromedriver ./chromedriver_2.11 --port=8765
  • 运行铬与 --remote-debugging-port=8765

但我没有其他想法如何启动chrome调试服务器.

我尝试过的有用链接对我不起作用:

更新1强制Chromedriver使用带有远程调试的Chrome实例

像在Mozilla文章中一样运行新的Chrome实例

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --no-first-run --no-default-browser-check --user-data-dir=$(mktemp -d -t 'chrome-remote_data_dir')
Run Code Online (Sandbox Code Playgroud)

在实习生集

intern.capabilities = {
  'selenium-version': …
Run Code Online (Sandbox Code Playgroud)

selenium google-chrome remote-debugging selenium-chromedriver intern

5
推荐指数
1
解决办法
1903
查看次数

从回调调用的addListener的sendResponse返回上一条消息

一开始我认为问题在于chrome.runtime.sendMessage()我发送了两条消息.一个用于访问localstorage,另一个用于获取/读取文件数据,但在将它们合并为一个之后没有任何改变,sendMessage这意味着实际问题是window.webkitRequestFileSystem()它返回的是先前的文件而不是当前文件.

是否有更好/更快的方式存储客户端?(我愿意尝试一切)?

的manifest.json

{
  "manifest_version": 2,

...
  "content_scripts": [
    {
      "matches": ["http://*/*", "https://*/*"],
      "js": ["content.js"],
      "run_at": "document_end"
    }
  ],
  "background": {
    "scripts": ["background.js"]
  },
  "permissions": [
    "unlimitedStorage"
  ]
}
Run Code Online (Sandbox Code Playgroud)

background.js

var theme = '';

chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
    if(request.method == "getTheme") {
      themes    = JSON.parse(localStorage["themes"]);
      themeName = "";
      for (var i = themes.length - 1; i >= 0; i--) {
        if(request.url.indexOf(themes[i]) !== -1) {
          themeName = themes[i];
        }
      };
      window.webkitRequestFileSystem(window.PERSISTENT, 0, readFromFileStorage.bind(window, …
Run Code Online (Sandbox Code Playgroud)

webkit google-chrome google-chrome-extension

1
推荐指数
1
解决办法
703
查看次数