I have been having trouble on referring to a search box on a website through Selenium in VBA. The HTML code of the box is:
<input type = "search" class ="form-control input-sm"
placeholder aria-controls="result_table"> ==$0
I have tried
bot.findElementByCssSelector(".form-control").SendKeys ("werresf")
bot.findElementByCssSelector(".form-control.input-sm").SendKeys ("werresf")
bot.findElementByCssSelector(".input-sm").SendKeys ("werresf")
bot.findElementByCssSelector(".form-control input-sm").SendKeys ("werresf")
bot.findElementByClassName("form-control input-sm").SendKeys ("werresf")
But none of them seems to work. Any help is greatly appreciated.
bot.FindElement(By.CssSelector(".form-control"));?bot.findElementByCssSelector(".form-control.input-sm").SendKeys ("werresf")should work in your case. But you might have multiple items matching with that CSS and Selenium will pick the first element in that case, which might be a hidden element. So please test your css.form-control.input-smin the browser devtools and then select the right item. Also make sure you point to the right frame, if any.