find text between <dt> exist and if its <dt> is not empty

19 views
Skip to first unread message

Majid Lotfi

unread,
Nov 15, 2017, 12:47:07 PM11/15/17
to Selenium Users

When a user click in a link a popup window should show some data with its values:

for example : Program Name : value Region : value Role : value

here is the html :

<div class="col-xs-12 provider-container">
  <div class="row">
    <dl class="dl-horizontal">
        <dt>Program</dt>
        <dd>Bright Horizons - No. Reading</dd>
        <dt>Program Type</dt>
        <dd>Large Group and School Age Child Care</dd>
        <dt>Region</dt>
        <dd></dd>
        <dt>Role</dt>
        <dd>Licensee</dd>
    </dl>
  </div>
</div>

The test should find out if the datas exist and if they have values, as you can see there is no dt that has text 'Role' and the data Region exists but it has empty value.

I started as this :

el = driver.find_elements(css: '.provider-container > dt').select {|el| el.text == 'Region'}.first

puts el

but nothing was printed.

Thanks.

Reply all
Reply to author
Forward
0 new messages