2

Developer exposes few internal values I need for testing as a display:none div:

<div class="veryuniqueclass" style="display:none;">&amp;QSC=11221.00&amp;QSN=11194.00&amp;CPCWC=0.02&amp;CPCN=790</div>

I need for futher calculations to capture text in that div (i.e. "&QSC=11221.00&QSN=11194.00&CPCWC=0.02&CPCN=790").

I have a webdriver elements for those divs. Browser element is variable b:

infoElements = b.divs(:class => "veryuniqueclass")
i1 = infoElements[0]

i1.text returns an empty string instead of a string with parameters I'm expecting. How to access what's between div and /div?

earlyadopter
  • 1,537
  • 4
  • 16
  • 21

2 Answers2

0

Found solution:

b.execute_script('return arguments[0].textContent', i1)

^ that returns: &QSC=11307.20&QSN=11250.50&CPCWC=0.02&bid=155"

Community
  • 1
  • 1
earlyadopter
  • 1,537
  • 4
  • 16
  • 21
0

If that is the only div with class veryuniqueclass, this should work:

browser.div(:class => "veryuniqueclass").text
Željko Filipin
  • 56,372
  • 28
  • 94
  • 125