我需要从表格单元格中获取值,它正在识别元素但不从中获取值。我试过了:
$driver-> get_text('xpath')
并且
$driver->find_element('xpath').get_text();
这些都不在这里工作。
HTML:
<td class="status">
<span class=" jira-issue-status-lozenge aui-lozenge jira-issue-status-lozenge-blue-gray jira-issue-status-lozenge-new aui-lozenge-subtle jira-issue-status-lozenge-max-width-medium"
data-tooltip="<span class="jira-issue-status-tooltip-title">Ready</span>" original-title="">Ready</span>
</td>
在这里我需要文本'Ready'。我尝试了以下代码:
#method 1
wait_until {print $driver->find_element('status','class_name')->get_text()};#also tried with xpath
------------------------------------------
#method 2
wait_until {$driver->get_text('//*[@id="issuerow102324"]/td[7]')};
我已经打开调试,我得到以下输出。
Prepping findElement
Executing findElement
REQ: POST, http://localhost:4444/wd/hub/session/cf170460-4cef-45d1-8513-9a740d1ac82b/element, {"using":"xpath","value":"//*[@id=\"issuerow102324\"]/td[7]/span"}
RES: {"value":{"element-6066-11e4-a52e-4f735466cecf":"922a947e-af04-4973-9834-c05604e00266"}}
Prepping getElementText
Executing getElementText
REQ: GET, http://localhost:4444/wd/hub/session/cf170460-4cef-45d1-8513-9a740d1ac82b/element/922a947e-af04-4973-9834-c05604e00266/text, {}
RES: read timeout at C:/Perl64/lib/Net/HTTP/Methods.pm line 268.
Error while executing command: Server returned error message read timeout at C:/Perl64/lib/Net/HTTP/Methods.pm line 268.
instead of data at C:/Perl64/site/lib/Selenium/Remote/Driver.pm line 403.
at C:/Perl64/site/lib/Selenium/Remote/Driver.pm line 353.
调试卡在“执行 getElementText”处,过了一会儿,它正在打印结果:读取超时。我真的不明白问题出在哪里。