mardi 19 mai 2020

Xpath following the for the next thumbnail - optimized solution? (for selenium automated solution)

At demo store http://automationpractice.com/index.php?id_category=3&controller=category we have a list of thumbnail

<ul class="product_list grid row">
  <li class="ajax_block_product....">
    <div class="product-container">
    <!-- at this level ist the thumbnail number 1 -->
    </div>
  </li>
  <li class="ajax_block_product....">
    <div class="product-container">
    <!-- at this level ist the thumbnail number 2 -->
    </div>
  </li>
  <li class="ajax_block_product....">
    <div class="product-container">
    <!-- at this level ist the thumbnail number 3 -->
    </div>
  </li>
</ul>

I want to navigate between thunbails easily throguh xpah, with a solution that fit all. But I don't have the xptah optimized for this solution.

Right now I have this, and i know is not the best solution (even it works for me)

thumbnail number 1 = //div[@class="product-container"]

thumbnail number 2 = //div[@class="product-container"]/following::div[@class="product-container"][1]

thumbnail number 3 = //div[@class="product-container"]/following::div[@class="product-container"][1]/following::div[@class="product-container"][1]

Aucun commentaire:

Enregistrer un commentaire