-1

I have been all the day trying to make:

  1. Wait 10 seconds between two actions in webdriver

  2. Waiting long enough for the element to displayed (the id element) (because in Internet Explorer get the error "Unable to find element with id == signin-email"and i try to

But in C# (not in java) I only found this code:

driver.Manage().Window.Maximize();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
driver.FindElement(By.Id("signin-email")).Clear();
driver.FindElement(By.Id("signin-email")).SendKeys("blabla");

I does not get an error, BUT it does not wait any seconds. All the codes I could find to do this are for java not work to C#.

Please

Lion6
  • 125
  • 1
  • 6
  • 16

3 Answers3

2

After a lot of hours searching I get the solution:

In C# for WebDriver only runs this code for Wait:

 System.Threading.Thread.Sleep(5000);

Because this other code, gets error:

 Thread.Sleep(5000);
Lion6
  • 125
  • 1
  • 6
  • 16
0

If you want to wait only for ten seconds try Thread.Sleep(10000)

Srivardhan
  • 104
  • 1
  • 3
  • 10
  • Finally I found the code that works in C# is only this: System.Threading.Thread.Sleep(5000); But I wonder how tell to the code miliseconds and not seconds between brackets? – Lion6 Jul 17 '14 at 11:26
  • Thread.Sleep(5000) is same as System.Threading.Thread.Sleep(5000). But in the first case you should have System.Threading in Using then you dont get error. – Srivardhan Jul 17 '14 at 13:12
0

Whilst sleeping will work, it makes for fragile tests. Have a read here:

I had the same issues when I started with webdriver so just trying to pass on some info. Hope it helps

Banjaxx
  • 624
  • 2
  • 18
  • 34