Chrome Inspect
The Code in C#
IWebElement Search =
driver.FindElement(By.XPath("//*[@placeholder='search' and
@type='text']"));
Actions actions_Search = new Actions(driver);
actions_Search.MoveToElement(Search).Click().SendKeys("ABCDEFG").Perform();
CodePudding user response:
Please check in the dev tools
(Google chrome) if we have unique entry in HTML DOM
or not.
xpath that you should check :
//input[contains(@class,'searchbox') and @placeholder='search' @type='text']
Steps to check:
Press F12 in Chrome
-> go to element
section -> do a CTRL F
-> then paste the xpath
and see, if your desired element
is getting highlighted with 1/1
matching node.
If we have unique entry 1/1 then you can use the following code :
IWebElement elem = driver.FindElement(By.Xpath("//input[contains(@class,'searchbox') and @placeholder='search' @type='text']")).SendKeys("ABCDEFG");
I am not certain why exactly you need an action class for this.