PHPUnit Selenium2 not returning text

 ̄綄美尐妖づ 提交于 2019-12-25 03:52:06

问题


I am trying to get the text value from an element and I tried lots of variation. nothing worked.. this is my latest attempt:

    $totalFlightPrice = $row->elements($row->using('css selector')->value('span[class="totalPriceToBook"]'));
    echo 'counted: '.count($totalFlightPrice)."\n";
    foreach ($totalFlightPrice as $tp) {
        echo 'text: '.$tp->text()."\n";
    }

when I'm using var_dump on totalFlightPrice I am receving the Object, which means its able to find the div. but when im using the text function nothing is returned.

this is my span element:

<span class="totalPriceToBook">382€</span>

回答1:


Try using getText() method http://docs.tadiavo.com/phpunit/www.phpunit.de/pocket_guide/3.1/en/selenium.html takes xpath of an element as a parameter.

$this->getText("xpath=//div/span[@class='totalFlightPrice");


来源:https://stackoverflow.com/questions/26698409/phpunit-selenium2-not-returning-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!