int i;
for (i = 0; i <= 10; i++)
{
Random rand_date = new Random();
foreach (HtmlElement element1 in webBrowser.Document.All)
{
if (element1.GetAttribute("name") == "migrationRequest.dayOfBirth")
{
element1.Children[rand_date.Next(1, element1.Children.Count)].SetAttribute("selected", "true");
}
}
foreach (HtmlElement element2 in webBrowser.Document.All)
{
if (element2.GetAttribute("name") == "migrationRequest.monthOfBirth")
{
element2.Children[rand_date.Next(1, element2.Children.Count)].SetAttribute("selected", "true");
}
}
foreach (HtmlElement element3 in webBrowser.Document.All)
{
if (element3.GetAttribute("name") == "migrationRequest.yearOfBirth")
{
element3.Children[rand_date.Next(1, element3.Children.Count)].SetAttribute("selected", "true");
}
}
public System.Windows.Forms.WebBrowser webBrowser = new System.Windows.Forms.WebBrowser();
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
for (i = 0; i <= 10; i++)
{
webBrowser.Navigate(new Uri("https://account.mojang.com/migrate"));
webBrowser.Navigated+=DoWork;
}
}
private void DoWork(object sender, WebBrowserNavigatedEventArgs e)
{
Random rand_date = new Random();
foreach (HtmlElement element1 in webBrowser.Document.All)
{
if (element1.GetAttribute("name") == "migrationRequest.dayOfBirth")
{
element1.Children[rand_date.Next(1, element1.Children.Count)].SetAttribute("selected", "true");
}
}
}