java - How to verify if search result has more than one result? -


can please how find search result has more 1 results using selenium , testng. scenario follows:

  1. launch www.amazon.com
  2. enter search string in search box , click search

now verify search result has more 1 result(>1). following line thought of assert.assertequals(actual, expected, delta);. right approach?

try below code. fetches search results , checks if count greater 1 or not, prints accordingly. :-

    driver.get("http://www.amazon.in/");      driver.findelement(by.id("twotabsearchtextbox")).sendkeys("bagsasdfafds");      int count = driver.findelements(by.classname("suggest_link")).size();      assert.asserttrue(count>=1);     system.out.println("count greater or equal 1. count is: "+count);//this line printed if count greater or equal 1. 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -