简体   繁体   English

PHPUnit Selenium2不返回文本

[英]PHPUnit Selenium2 not returning text

I am trying to get the text value from an element and I tried lots of variation. 我试图从一个元素获取text值,并且尝试了很多变化。 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. 当我在totalFlightPrice上使用var_dump时,我正在接收Object,这意味着它能够找到div。 but when im using the text function nothing is returned. 但是当im使用text函数时,什么也不会返回。

this is my span element: 这是我的span元素:

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

尝试使用getText()方法http://docs.tadiavo.com/phpunit/www.phpunit.de/pocket_guide/3.1/en/selenium.html将元素的xpath作为参数。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM