I am creating a mass username availability checker for a forum but when the timers are set to a high speed it sometimes says a username is available for the forum when it’s unavailable.
How can I ensure it’s checked the username properly before it skips to the next username in my listbox?
Example of my code:
// Timer1
timer1.Stop();
webBrowser1.Document.GetElementById("username").InnerText = list.SelectedItem.ToString();
webBrowser1.Document.GetElementById("register").InvokeMember("Click");
list.SelectedIndex = list.SelectedIndex + 1;
timer2.Start();
// Timer2
timer2.Stop();
if (webBrowser1.Document.GetElementById("status").ToString().Contains("available"))
{
list2.Items.Add(list.SelectedItem.ToString());
timer1.Start();
}
else
{
timer1.Start();
}
Could I use WatiN or something to ensure it waits for it to check the availability of a username before it skips to the next tag? The page does not reload.
You can poll the page content contains X or Y, then continue. I’m assuming here that the page will display “available” or “sorry, pick something else” message. If you don’t have a yes/no status displayed, this is going to be tougher.
Something like the following: This is not tested code, just a rough idea of types of things I’ve done in scenarios like yours.