am struggling to set up count in watir -


I am trying to see if specific results are present on the page or not. There can be 6 sponsored results on any page. I have tried to set up to make the count, so long as no other results are present, it checks, but it only checks the first result and does not move forward to check the rest.

I created the following

  @ continue = 'yes' @ count = 0 @continue == 'no' if @b DIV (: class = & gt; 'sponsored result' ,: index = & gt; @ country). Link (: index, 0). Axis? 'PASS - This ad is for a business vehicle' and puts 'Fail - This ad is not for a business vehicle.' End sleep (1) @ calculation + = 1 @ release = 'no' end  

Can you please advise why it sees only the first result on the page?

If apology is ambiguous but new to this, please tell me if you need to provide me with more information.

Thanks

Mark

Try it out:

  result = 'failed - this ad is not for a business vehicle.' @ B.divs (: class => 'Sponsored Results'). Every do Div | | If div.link.exists? Results = 'Pass - This Ad is for a Commercial Vehicle' as a result of Break & End.  

Comments