#2440
Michael
Guest

Hello

You can enter valid C# code that will randomize values to be entered. For example, this code represents choosing randomly male or female gender:

// script_version=3.0; everystep_version=4.0.5953.25078; date=4/19/2016; IE=11.0.9600.17126
Tabs.ConfigureIEVersion (BrowserMode.IE11, DocumentMode.IE11Emulate);
Tabs.SetSize (1768, 714);
DMBrowser tab0 = null;
Step (1, “visible – http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_radio”);
tab0 = Tabs.NewTab ();
tab0.GoTo (“http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_radio”);
for (int i = 0; i < 5; i++)
{
// produces random number in range from 0 to 2
int r = (new Random(DateTime.Now.Second)).Next(0, 3);
if (r == 0)
{
tab0.Frame (“//IFRAME[@ID=\”iframeResult\”]”, “//IFRAME”).RadioButton (“//INPUT[@VALUE=\”female\”]”, “//INPUT[@VALUE=\”other\”]/preceding-sibling::INPUT[1]”, “//INPUT[@VALUE=\”male\”]/following-sibling::INPUT[1]”).Click ();
}
else if (r == 1)
{
tab0.Frame (“//IFRAME[@ID=\”iframeResult\”]”, “//IFRAME”).RadioButton (“//INPUT[@VALUE=\”other\”]”, “//INPUT[@VALUE=\”female\”]/following-sibling::INPUT[1]”, “//INPUT[@VALUE=\”male\”]/following-sibling::INPUT[2]”).Click ();
}
else if (r == 2)
{
tab0.Frame (“//IFRAME[@ID=\”iframeResult\”]”, “//IFRAME”).RadioButton (“//INPUT[@VALUE=\”male\”]”, “(//INPUT[@TYPE=\”radio\”])[1]”, “(//INPUT[@NAME=\”gender\”])[1]”).Click ();
}
Delay (“3sec”.ToDuration ());
}

Regards,
Michael Minaev
Dotcom-monitor.com | Support