这是我拥有的跨度标签:
<span id="CD417" oncontextmenu="myR(this)" style="cursor: pointer;" spanparent="RD417" reportinfostring="417|N|N|K1|1">
<img src="images/mydocument.gif" title="Rep" style="width:24px; height:24px;" spanparent="RD417" reportinfostring="417|N|N|K1|1" border="0">
This_is_the_Text_I_Need_To_Get
</span>
我正在寻找“This_is_the_Text_I_Need_To_Get”,这是我的代码的一部分:
$items = $driver->findElements(WebDriverBy::tagName("span"));
foreach ($items as $item) {
if ( $item->getAttribute('id') != "" ) {
echo "Item ID: "; var_dump($item->getAttribute('id'));
echo "Item getText: "; var_dump($item->getText());
echo "Item innerHTML: "; var_dump($item->getAttribute('innerHTML'));
}
}
我得到了什么:
Item ID: string(10) "CD417"
Item getText: string(0) ""
Item innerHTML: NULL
我应该怎么办?