jeudi 2 janvier 2020

How find tag using capybara/ruby/cucumber/selenium/xpath

I would like to know the best way to find the element and click in my automation project, using ruby / capybara / selenium / cucumber / xpath / etc...

The html element i need to click and expand (equal accordion) is this:

<a href="javascript:;" class="dcjq-parent">
  <i class=""></i>
  <span>Customs Reports</span>
  <span class="dcjq-icon"></span>
</a>

I currently use the xpath command to find the element and click, but it doesn't work very well because it is finding the element but sometimes clicks and sometimes doesn't

page.find(:xpath, "//*[text()='Customs Reports']").click

1 commentaire: