Sam
Sam

Reputation: 19

Selinium webdriver C# Not able to enter text in the text field using

I am not able to enter text in the text box field using selenium webdriver C# and IE11. It opened the URL and clicked on the login button but it's not entering the username.

My code to enter text in the username textbox field is

IWebElement myField = driver.FindElement(By.Id(“Loginlogin”));
myField.SendKeys("sandy");

HTML

<form method="post" name="Login" action="lg01.asp?ccsForm=Login">
   <table class="RecordImpac" cellspacing="0" cellpadding="0">
      <tr class="Controls">
         <td><strong>Username</strong></td>
      </tr>
      <tr class="Controls">
         <td valign="top">
            <input id="Loginlogin" maxlength="100" size="30" value="" name="login">
            <br>
         </td>
      </tr>

Env:

Browser IE11
IE webdriver server: IEDriverServer_x64_2.47.0
Visual Studio 2015 community

Upvotes: 0

Views: 871

Answers (1)

MKay
MKay

Reputation: 836

I could successfully send the text to username textbox. Code is in Java. You can convert to C# accordingly. Try putting some implicit wait.

System.setProperty("webdriver.ie.driver","pathtoiedriver\\IEDriverServer.exe");
      WebDriver driver=new InternetExplorerDriver();
    driver.get("location/test_html.html");
    driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);

    driver.findElement(By.id("Loginlogin")).sendKeys("sandy");

Upvotes: 1

Related Questions