0

Using C# I was trying to replace a value from input box like this

        for (int second = 0; ; second++)
        {
            if (second >= 60) Assert.Fail("timeout");
            if (second > 15) break;

         Thread.Sleep(1000);
      }

        driver.FindElement(By.Id("input1")).Clear();
        driver.FindElement(By.Id("input1")).SendKeys(xxxx");

but I get error "element is not currently intractable and may not be manipulated" on the clear() line , why is that although I wait until page load ?

HTML

<input class="valid" id="input1" name="input1" value="http://dddd" nametemplate="url_to_5D" type="text">
zac
  • 4,495
  • 15
  • 62
  • 127

1 Answers1

6

You may try to wait for it:

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
IWebElement element = wait.Until(ExpectedConditions.ElementExists(By.Id("input1")));

and then:

element.Clear();
element.SendKeys("xxxx");

To make your driver wait before any action simply:

driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));

If you use the above code, you can remove all the Thread.Sleep(1000) actions.

Grzegorz Górkiewicz
  • 4,496
  • 4
  • 22
  • 38