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.
1 Answer
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.
-
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 Commented Nov 8, 2018 at 14:09
-
Verify if there are multiple matches occurs in finding the element or verify the element is present inside the frame Commented Nov 8, 2018 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' Commented Nov 8, 2018 at 16:19