PHPUnit Selenium2不返回文本 [英] PHPUnit Selenium2 not returning text

查看:99
本文介绍了PHPUnit Selenium2不返回文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从元素中获取text值,并且尝试了很多变化.没有任何效果..这是我最近的尝试:

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";
    }

当我在totalFlightPrice上使用var_dump时,我正在接收Object,这意味着它能够找到div. 但是当我使用text函数时,什么也不会返回.

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.

这是我的span元素:

this is my span element:

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

推荐答案

尝试使用getText()方法

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");

这篇关于PHPUnit Selenium2不返回文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆