Verify Search Results

How to verify search results corresponding to entered keyword?
Suppose you entered "Shirts" in Amazon search field then how you can verify that search result are relevant to "shirts"?

Showing Answers 1 - 0 of 0 Answers

Venkata Bharadwaj Racherla

  • Mar 27th, 2017
 

Code
  1.  WebDriver driver = new FirefoxDriver();

  2.             driver.get("http://[domain name]");

  3.             driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

  4.             Actions action = new Actions(driver);

  5.             WebElement search = driver.findElement(By.xpath(".//*[@id=twotabsearchtextbox]"));

  6.  

  7.             //Search using actions by combining entering search string and then hit enter

  8.             action.click(search).sendKeys("Shirt").sendKeys(Keys.RETURN).build().perform();

  9.  

  10.             // This also works where it does the same without actions class

  11.             search.sendKeys("Shirt");

  12.             search.sendKeys(Keys.RETURN);

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Answer Question

Click here to Login / Register your free account


 
Send   Reset

 

Related Answered Questions

 

Related Open Questions