I am trying to automate a web page using the gecko engine, it is similar to the webBrowser that has Visual Studio incorporated. I'm using the event
navegador.DocumentCompleted += (senderx, ex)=>
To wait for the page to be completed, I am doing well with everything but an input that sometimes fills it and sometimes passes it by, I read it in the following way
Gecko.DOM.GeckoInputElement input = (Gecko.DOM.GeckoInputElement)document.GetElementsByName("txtorderNo")[0];
input.SetAttribute("value", "aKl8_Sbl");
input.Value = "aKl8_Sbl";
To avoid being skipped I want to pause, the issue is that I'm having trouble with that, poor things and nothing works for me
- The IsBusy and IsAjaxBusy methods always return false
- The "System.Threading.Thread.Sleep" does not work for me because it slows down the browser load so it's like nothing
-
Using this code makes me wait but I get the following error.
{"Specified argument was out of the range of valid values. \ r \ nParameter name: index"}
public void Esperar(int tiempo) { DateTime reloj = DateTime.Now; reloj = reloj.AddSeconds(tiempo); while (reloj > DateTime.Now) { Application.DoEvents(); } }
-
The other two I use are these but they do not work for me either
async Task Delay() { await Task.Delay(100000); } public void Wait(double seconds) { Timer timer = new Timer(); timer.Interval = (int)(seconds * 1000); timer.Tick += (s, o) => { timer.Enabled = false; timer.Dispose(); }; timer.Enabled = true; }
If anyone has an answer, I hope you can help me, regards