1

I have a problem when trying to find an element with different attribute as sample bellow

<i>bold</i>
Sometime
<i class='icon'/i>

I want to try inspecting this element with OR operator in PageObject

For example: i(:icon_bold, text: 'bold' OR class: 'icon') (just example, this is not correct)

So please help me to give a correct syntax to locator.

  • Why not just write a conditional that tries to find it by using one identifier, else try the second identifier? – ernie Dec 26 '17 at 17:35
  • Thanks for your consider. I have to use xpath i(:bold_icon, xpath: ".//i[text()='bold' or @class='icon']"). I just want different way and better than using xpath. – Thy Nguyen Jan 3 '18 at 10:29
  • <div class="input-content btn-group" data-toggle="buttons"> <div class="input-label">Style:</div> <label class="btn btn-default btn-sm "> <i class="icon_i“></i> <i class="icon_b“></i> <i class="icon_u“></i> </div> … Some time <div class="input-content btn-group" data-toggle="buttons"> <div class="input-label">Style:</div> <label class="btn btn-default btn-sm "> <i>I</i> <i>B</i> <i>U</i> </div> … – Thy Nguyen Jan 3 '18 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.