If you need to do auto-responding to SurveyMonkey surveys, you can perchance use the below C# code as a source of inspiration.
I used it for testing a survey that we had running internally. Please bear in mind that your company's SurveyMonkey-subscription might put a cap on the number of survey-responses.
Basically it works by utilizing the Selenium library (download it care of Nuget) for web-page testing. I used the Chrome web-driver because it didn't store cookies or history for the browser session. I also included a unique temporary value for when accessing the survey, or I would get the "you've already responded"-message.
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 58; i++)
{
RespondToSurvey();
Console.WriteLine(i);
}
}
private static void RespondToSurvey()
{
OpenQA.Selenium.Chrome.ChromeDriver driver = new OpenQA.Selenium.Chrome.ChromeDriver();
string baseUrl = $@"https://da.surveymonkey.com/r/?tempValue=" + DateTime.Now.Ticks;
driver.Navigate().GoToUrl(baseUrl + "/");
Actions actions = new Actions(driver);
IWebElement radioBtn = driver.FindElementById("72374030_573987619");
actions.MoveToElement(radioBtn).Click().Perform();
var element = driver.FindElement(By.Name("surveyForm"));
element.Submit();
driver.Close();
}
}
Ingen kommentarer:
Send en kommentar