Cannot fetch value from table using Selenium::Remote::Driver in perl

限于喜欢 提交于 2020-07-09 17:09:04

问题


I need to take value from a table cell and it is identifying the element but not fetching the value out of it. I've tried:

$driver-> get_text('xpath') 

and also

$driver->find_element('xpath').get_text();

None of these are working here.

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=&quot;jira-issue-status-tooltip-title&quot;>Ready</span>" original-title="">Ready</span>    
</td>

Here I need the text 'Ready'. I tried the following code:

#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]')};

I've turned on debug and I'm getting the following output.

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.

Debug stucks at 'Executing getElementText' and after a while, it's printing the result: read timeout. I'm really not understanding where the problem is.

来源:https://stackoverflow.com/questions/62755049/cannot-fetch-value-from-table-using-seleniumremotedriver-in-perl

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