dongqiuwei8667 2016-11-03 10:18
浏览 266

错误:必须通过webdriver.gecko.driver系统属性设置驱动程序可执行文件的路径

I am working on an automated functional unit testing in PHP. I want to run a test on staging environment using PhpStorm and I am following this link: https://www.sitepoint.com/using-selenium-with-phpunit/. I have complete tasks up-to this code : i have visited this link but not work for me. The path to the driver executable must be set by the webdriver.gecko.driver system property

<?php

/**
 * Created by PhpStorm.
 * User: Developer4
 * Date: 11/2/2016
 * Time: 1:41 PM
 */
class uatTest extends PHPUnit_Extensions_Selenium2TestCase
{
    public function setUp()
    {
        $this->setHost('localhost');
        $this->setPort(4444);
        $this->setBrowserUrl('https://www.facebook.com/');

        $this->setBrowser('firefox');
    }
    public function tearDown()
    {
        $this->stop();
    }
    public function validInputsProvider()
    {
        $inputs[] = [
            [
                'email'              => 'user',
                'pass'              => 'pass'
            ]
        ];
        return $inputs;
    }
    public function testFormSubmissionWithUsername()
    {
        $this->byName('email')->value('user');
        $this->byId('loginbutton')->submit();
        $email = $this->byName('email');
        $this->assertEquals('user', $email->value());
    }
}

as my selenium server is running: enter image description here

when i have run my test on phpstorm i get this error enter image description here

Error:

C:\wamp\bin\php\php5.6.25\php.exe C:/wamp/www/PHPUnit-and-Composer-Workflow/vendor/phpunit/phpunit/phpunit --no-configuration uatTest C:\wamp\www\PHPUnit-and-Composer-Workflow\test\uatTest.php --teamcity
Testing started at 2:53 PM ...
PHPUnit 5.6.2 by Sebastian Bergmann and contributors.


The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases
 C:\wamp\www\PHPUnit-and-Composer-Workflow\vendor\phpunit\phpunit-selenium\PHPUnit\Extensions\Selenium2TestCase\Driver.php:165
 C:\wamp\www\PHPUnit-and-Composer-Workflow\vendor\phpunit\phpunit-selenium\PHPUnit\Extensions\Selenium2TestCase\Driver.php:72
 C:\wamp\www\PHPUnit-and-Composer-Workflow\vendor\phpunit\phpunit-selenium\PHPUnit\Extensions\Selenium2TestCase\SessionStrategy\Isolated.php:67
 C:\wamp\www\PHPUnit-and-Composer-Workflow\vendor\phpunit\phpunit-selenium\PHPUnit\Extensions\Selenium2TestCase.php:296
 C:\wamp\www\PHPUnit-and-Composer-Workflow\vendor\phpunit\phpunit-selenium\PHPUnit\Extensions\Selenium2TestCase.php:337
 C:\wamp\www\PHPUnit-and-Composer-Workflow\vendor\phpunit\phpunit-selenium\PHPUnit\Extensions\Selenium2TestCase.php:314



Time: 823 ms, Memory: 3.50MB


ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

Process finished with exit code 2

and also get exeception on cmd: enter image description here

  • 写回答

1条回答 默认 最新

  • duanqian9593 2016-11-03 15:36
    关注

    this is solution:

        java -Dwebdriver.gecko.driver="C:\Users\Developer4\Downloads\geckodriver-v0.11.1-win32\geckodriver.exe" -jar C:\wamp\bin\php
    
    \php5.6.25\selenium-server-standalone-3.0.1.jar
    
    评论

报告相同问题?

悬赏问题

  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值