enter image description here

Hi, I am trying to locate and click on the element that comes up in the search box when I type some name. Can someone please help me out to find & click on the name? I've use searching by XPath - contains(@class, '...'); contains(text()) etc, but everytime it fails.

When I inspect the element, I see this HTML: enter image description here

  • Never mind! Got my own solution. Thanks for help!! – selenium test Nov 8 at 17:15

Use Action class and move to the search suggestions element first then perform your action.

Actions action = new Action(driver);
action.MoveToElement("Locator of the element").Perform();

Use the above method to try accessing the search suggestion element.

  • Thanks Prasanna for your response!! – selenium test Nov 8 at 14:08
  • I tried it but the focus is shifted to the 'Overview' section - top left. I did this: OpenQA.Selenium.Interactions.Actions actions = new OpenQA.Selenium.Interactions.Actions(driver); actions.MoveToElement(driver.FindElement(By.XPath("//span[contains(text(),'Acura West')]"))).Perform(); Can you please help. I'm kinda stuck – selenium test Nov 8 at 14:09
  • Verify if there are multiple matches occurs in finding the element or verify the element is present inside the frame – Prasanna venkatesh Nov 8 at 16:03
  • I'm trying this: PopupWindowFinder finder = new PopupWindowFinder(driver); String advName = rowValue[0]; IWebElement adv = driver.FindElement(By.XPath("//*[contains(@placeholder, 'Add filter')]")); string popupWindowHandle = finder.Click(adv.SendKeys(advName)); So, the popup only triggers when I type in some text in the 'Add filter' (search box basically) I don't know how to do that using: string popupWindowHandle = finder.Click(adv.SendKeys(advName)); I get an error here 'cannot convert from 'void' to 'OpenQA.Selenium.IWebElement' – selenium test Nov 8 at 16:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.