Selenium strange behavior when attempting to select a specific input box

Skip to first unread message

Eric Liu

Feb 4, 2020, 7:12:23 AM2/4/20
to Selenium Developers
I've been using the same code to select and input text into an input box with no errors until recently. The code looks something like this:

public class page {
   private By input = By.cssSelector("input");

   public void setInput(String text) {

I create a page object and call setInput() like so:

page p = new page(driver);

This methodology has been working throughout my entire code base for months up until now. Selenium seems to be behaving very strangely and will crash when attempting to select and input into the box.
However, if I just explicitly write out


in my testing class instead of creating a page object and calling setInput(), it works fine. This is very strange because only this particular method/input box behaves like so. All other input boxes on the page behave normally. 
I am using chromeDriver. Has anyone else encountered these issues? Thanks

Jonathan Herbaut

Feb 17, 2020, 5:16:51 AM2/17/20
to Selenium Developers
Are you forced to use the click function before you use your sendKeys method ?
In C#, I use the clear function before using my sendKeys function.
This would help us if you say to us when you get your exception and what is the nature of your exception

iranibalooch noor

Feb 17, 2020, 5:17:15 AM2/17/20

متشکرم بسیارمفیدواقع شد

در تاریخ ۵ فوریهٔ ۲۰۲۰ ۰:۱۲، "Eric Liu" <> نوشت:
You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages