PHPUnit_Extensions_Selenium2TestCase完成时返回数据
我正在使用selenium/PHPUnit\u Extensions\u Selenium2TestCase在我的表单上运行一些测试 在我的网站显示ID的最后一步中,我正在测试订阅表单(出于某种原因)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
.......
你的身份证号码是: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";
}
}