WebDriver: 当前 url 为空白,未打开任何页面

WebDriver: Current url is blank, no page was opened

我们正在尝试将测试添加为实时站点更新部署的一部分。测试 运行 在一周前我们最后一次处理它们时还不错,但现在它们都抛出了这个错误。我们已经尝试弄明白了,但没有找到任何有价值的东西。

更新 1: 我们发现该功能因软件包更新而中断。这是更新包的列表;

barryvdh/laravel-debugbar             2.0.6 -> 2.1.1
barryvdh/laravel-ide-helper           2.1.0 -> 2.1.2
codeception/codeception               2.1.4 -> 2.1.5
doctrine/cache                        1.5.2 -> 1.6.0
laravel/framework                     5.1.26 -> 5.1.28
league/flysystem                      1.0.15 -> 1.0.16
maximebf/debugbar                     1.10.5 -> 1.11.0
phpspec/phpspec                       2.4.0 -> 2.4.1
phpunit/phpunit                       4.8.20 -> 4.8.21
symfony/browser-kit                   2.8.0 -> 2.8.1
symfony/class-loader                  2.8.0 -> 2.8.1
symfony/console                       2.7.7 -> 2.7.8 
symfony/css-selector                  2.7.7 -> 2.7.8 
symfony/debug                         2.7.7 -> 2.7.8 
symfony/dom-crawler                   2.7.7 -> 2.7.8 
symfony/event-dispatcher              2.8.0 -> 2.8.1
symfony/finder                        2.7.7 -> 2.7.8 
symfony/http-foundation               2.7.7 -> 2.7.8 
symfony/http-kernel                   2.7.7 -> 2.7.8 
symfony/polyfill-php56                1.0.0 -> 1.0.1
symfony/polyfill-util                 1.0.0 -> 1.0.1
symfony/process                       2.7.7 -> 2.7.8 
symfony/routing                       2.7.7 -> 2.7.8 
symfony/translation                   2.7.7 -> 2.7.8 
symfony/var-dumper                    2.7.7 -> 2.7.8 
symfony/yaml                          2.8.0 -> 3.0.1

更新 2: 我们已尝试降级 laravel 和代码接收但无济于事。它是 st运行ge,因为已经更新过一次的机器即使降级到 codeception 2.1.0 也会始终抛出该错误。而通过所有测试的机器是在 codeception 2.1.4 和 webdriver 1.1.0 上。

更新 3: 安装 selenium 只是为了检查它是否有效,所以可能它的 phantomJS / ghost-driver 有冲突。

示例测试

public function test(AcceptanceTester $I) 
{
    $I->amOnUrl('http://swaggable.com');
    $I->canSeeCurrentUrlEquals('/');
}

示例输出

Failed to check correct credentials in _001PlatformSignupCest::checkCorrectCredentials (tests\acceptance\_001PlatformSIgnupCest.php)


  [ModuleException] WebDriver: Current url is blank, no page was opened


Scenario Steps:

 3. $I->canSeeCurrentUrlEquals("/signup")
 2. $I->amOnUrl("http://platform.work.com/signup")
 1. $I->resizeWindow(1280,720)

验收配置:

modules:
    enabled:
        - Asserts
        - WebDriver:
            url: http://platform.work.com
            browser: firefox
            http_proxy: direct
        - \Helper\Acceptance

设置:

作曲家

"require": {
    "php": ">=5.5.9",
    "laravel/framework": "5.1.*",
    "barryvdh/laravel-ide-helper": "^2.0",
    "sboo/multiauth": "4.0.*",
    "dingo/api": "0.10.*",
    "doctrine/dbal": "2.3.*",
    "rtconner/laravel-kint": "~2.0",
    "factual/factual-php-driver": "dev-master",
    "weblee/mandrill": "dev-master",
    "barryvdh/laravel-debugbar": "^2.0",
    "laravel/envoy": "~1.0",
    "jeremeamia/superclosure": "~2.0",
    "illuminate/html": "~5.0",
    "predis/predis": "^1.0",
    "guzzlehttp/guzzle": "~5.3|~6.0",
    "laravelcollective/html": "5.1.*",
    "exeu/apai-io": "dev-master",
    "codeception/codeception": "*"
},
"require-dev": {
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~4.0",
    "phpspec/phpspec": "~2.1",
    "fzaninotto/faker": "~1.0"
},

你好,我也遇到了同样的问题。

我已经将phantomjs降级到1.9.7版本

   ...
    "jonnyw/php-phantomjs": "3.*",
    "site5/phantoman": "^1.0"
  },
  "require-dev": {
    "phpunit/phpunit": "~4.0",
    "phpspec/phpspec": "~2.1"
  },
  "autoload": {
    "classmap": [
      "database"
    ],
    "psr-4": {
      "App\": "app/"
    }
  },
  "autoload-dev": {
    "classmap": [
      "tests/TestCase.php"
    ]
  },
  "scripts": {
    "post-install-cmd": [
      "php artisan clear-compiled",
      "PhantomInstaller\Installer::installPhantomJS",
      "php artisan optimize"
    ],
    "post-update-cmd": [
      "php artisan clear-compiled",
      "PhantomInstaller\Installer::installPhantomJS",
      "php artisan optimize"
    ],
    "post-create-project-cmd": [
      "php -r \"copy('.env.example', '.env');\"",
      "php artisan key:generate"
    ]
  },
  "config": {
    "preferred-install": "dist",
    "bin-dir": "bin"
  }
}

它现在可以工作了,但我知道这是一个解决方法