I have a selenium test that works great while debugging and stepping slowly through. I added a Thread.Sleep()
in order to stop selenium while a file is downloaded. However selenium in completely ignoring the Thread.Sleep()
. Any thoughts?
IWebElement iframe = driver.FindElement(By.Id("genFrame"));
CurrentFrame = driver.SwtichTo();
CurrentFrame.Frame(iframe);
driver.FindElement(By.Id("date").Sendkeys("05/11/2021" + Keys.Enter));
driver.FindElement(By.Id("export-btn"));
System.Thread.Sleep(5000);
In all possibilities System.Thread.Sleep()
is never ignored unless some previous line of code raises an exception.
As per your code the unit is milliseconds , so effectively 5000 milliseconds, ie 5 seconds.
You may like to increase the waiting time to greater value, eg 10 seconds or more:
using System;
using System.Threading;
System.Thread.Sleep(10000);
As you can visually see selenium add the date field, possibly the line in the mid:
driver.FindElement(By.Id("export-btn"));
raises an exception.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.