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:
- launch www.amazon.com
 - 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
Post a Comment