Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHPUnit_Extensions_Selenium2TestCase完成时返回数据_Php_Selenium_Selenium Webdriver_Phpunit - Fatal编程技术网

PHPUnit_Extensions_Selenium2TestCase完成时返回数据

PHPUnit_Extensions_Selenium2TestCase完成时返回数据,php,selenium,selenium-webdriver,phpunit,Php,Selenium,Selenium Webdriver,Phpunit,我正在使用selenium/PHPUnit\u Extensions\u Selenium2TestCase在我的表单上运行一些测试 在我的网站显示ID的最后一步中,我正在测试订阅表单(出于某种原因) ....... 你的身份证号码是:1254686grd ....... 所以在测试结束时,我想返回这个ID 有办法吗 我试图使用$this->source(),但测试控制台中没有显示任何内容 谢谢。试试看 echo $this->byCssSelector("selector")-&g

我正在使用selenium/PHPUnit\u Extensions\u Selenium2TestCase在我的表单上运行一些测试

在我的网站显示ID的最后一步中,我正在测试订阅表单(出于某种原因)


....... 
你的身份证号码是:1254686grd
.......
所以在测试结束时,我想返回这个ID

有办法吗

我试图使用$this->source(),但测试控制台中没有显示任何内容

谢谢。

试试看

echo $this->byCssSelector("selector")->text();
我使用github进行了测试:

class S2p_GoogleTest extends PHPUnit_Extensions_Selenium2TestCase{

    function setUp(){
        $this->setBrowser("phantomjs");
        $this->setBrowserUrl("https://github.com/");
        $this->setHost("127.0.0.1");
        $this->setPort(4444);
    }

    function testGithub(){
        $this->url('/');
        echo "\n";
        echo $this->byCssSelector(".heading")->text() . "\n";
     }

}
它打印:

class S2p_GoogleTest extends PHPUnit_Extensions_Selenium2TestCase{

    function setUp(){
        $this->setBrowser("phantomjs");
        $this->setBrowserUrl("https://github.com/");
        $this->setHost("127.0.0.1");
        $this->setPort(4444);
    }

    function testGithub(){
        $this->url('/');
        echo "\n";
        echo $this->byCssSelector(".heading")->text() . "\n";
     }

}