1

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.

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Sahal
  • 105
  • 13
  • Also add your Perl code and that xpath you're feedign into the function. – pavelsaman Jul 06 '20 at 13:04
  • @pavelsaman I have added code in the question now. Please check it – Sahal Jul 06 '20 at 13:49
  • @pavelsaman I force installed this Selenium::Remote::Driver. May be becz of that? – Sahal Jul 06 '20 at 15:31
  • @Sahal I tried install `Selenium::Remote::Server` on Windows 10, Strawberry perl version 5.30.1 and it stalled fine without needing to force install it. Can you give more details on your perl script. When I am trying to run the simple test script on [the documentation page](https://metacpan.org/pod/Selenium::Remote::Driver) I get error: `Selenium server did not return proper status at C:/Strawberry/perl/site/lib/Selenium/Remote/Driver.pm line 543.` – Håkon Hægland Jul 06 '20 at 16:29
  • 1
    Actually you have to run the selenium-standalone-server before executing the program. you can download it from https://www.nuget.org/packages/selenium-server-standalone/3.4.0. And also download gecko driver to run it from firefox.Then paste the following code in cmd , so the selenium server will run. java "-Dwebdriver.gecko.driver=driver/geckodriver.exe" -jar driver/selenium-server-standalone.jar -host localhost -port 4444' . Here you should paste both files in same directory in which your cmd is currently pointed to – Sahal Jul 06 '20 at 16:43
  • @HåkonHægland Im using ActiveState Perl – Sahal Jul 06 '20 at 16:53
  • @Sahal Did you install the Microsoft Visual C++ Redistributable for Visual Studio? According to [this](https://github.com/mozilla/geckodriver/releases) page it is needed for geckodriver on Windows – Håkon Hægland Jul 06 '20 at 17:20
  • @HåkonHægland Microsoft Visual C++ redistributable is already installed in my system – Sahal Jul 06 '20 at 17:30
  • @Sahal Ok, I now have the server up and running: `20:01:23.567 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444` but the Perl script still says: `Selenium server did not return proper status at C:/Strawberry/perl/site/lib/Selenium/Remote/Driver.pm line 543` – Håkon Hægland Jul 06 '20 at 18:04
  • @HåkonHægland I installed strawberry Perl and now I'm getting same error as yours.Before I was working on Active state perl – Sahal Jul 06 '20 at 18:18
  • @Sahal Maybe related: [Accessing IPv6 resolvable URL with port (e.g. localhost:12345) results in Bad Address in Strawberry Perl 5.30.1](https://stackoverflow.com/q/61455027/2173773) – Håkon Hægland Jul 06 '20 at 18:23
  • @Sahal Added [a new question](https://stackoverflow.com/q/62762851/2173773) addressing the issue – Håkon Hægland Jul 06 '20 at 19:07
  • @Sahal Do I also need to install firefox? – Håkon Hægland Jul 06 '20 at 19:32
  • @Sahal It now works for me after installing `firefox` and using `127.0.0.1` instead of `localhost` – Håkon Hægland Jul 06 '20 at 19:45
  • 1
    @HåkonHægland Thank you for your efforts. It's my time to sleep. I'll check it tomorrow – Sahal Jul 06 '20 at 21:24

0 Answers0