Creating a Survey Bot: Highlights from ASC’s First Coffee Morning

I’m thrilled to recap our very first ASC virtual coffee morning. For those who couldn’t join, let me give you a quick introduction to what we’ve started.

The ASC’s inaugural virtual coffee morning is an exciting new venture, designed to bring together professionals in the survey industry in a relaxed, informal setting. This free event, which we plan to host every few weeks, is the perfect platform for us to engage in loose agenda-driven discussions about survey research. It’s an invaluable opportunity for us to connect, share insights, and explore collaborative possibilities in our field.

While we’re not recording these sessions to maintain a casual atmosphere, we’re committed to sharing a brief summary post-event to highlight the key topics we cover. This is just one of many ways we’re looking to foster a strong, interactive community in the survey research world.

Now, let’s dive into the heart of our latest discussion where looked at wheterh we could createa survey bot with open-source tools. We weren’t looking to create a fully working bot but just a thought starter.

Let’s start with the python script we discussed:

import time
import random
from selenium import webdriver
from selenium.webdriver.common.by import By

if __name__ == '__main__':
    driver = webdriver.Chrome()
    driver.get('YOUR_SURVEY_URL_HERE')
    time.sleep(2)

    input_elements = driver.find_elements(by=By.XPATH, value="//input")

    for element in input_elements:
        role = element.get_attribute('type')

        if role == 'radio':
            element.click()
            time.sleep(4)
        elif role == 'checkbox':
            if random.random() > 0.5:
                element.click()
                time.sleep(4)
        elif role == 'text':
            numeric_style_questions = ["how many", "many", "%", "percent", "number"]
            if any(item in element.accessible_name for item in numeric_style_questions):
                element.send_keys(random.randint(1, 100))
                time.sleep(4)
            else:
                element.send_keys("some random text")
                time.sleep(4)
    submit_button = driver.find_element(by=By.XPATH, value='//button')
    submit_button.click()
    driver.quit()

Setting It Up

  • Install Selenium: First, you need Selenium, a powerful tool for web browser automation. You can install it via pip: pip install selenium.
  • WebDriver: Ensure you have a WebDriver for Chrome installed. It lets Selenium control the browser.
  • Script Modifications: Replace ‘YOUR_SURVEY_URL_HERE’ with the actual URL of the survey you wish to automate.

Now, onto our discussion:

The Blend of Simplicity and Complexity

We noted that while this script is simple, scaling it to handle complex, production-level surveys presents challenges. For instance, server-side logic in surveys, which our bot can’t interpret, adds a layer of complexity.

AI’s Emerging Role

The idea of integrating AI, such as GPT models, was a highlight. AI could potentially understand and interact with surveys more dynamically, making the process quicker and more human-like.

Ethical Discussions

Syndicated Data vs. Authentic Responses: Using AI to complete surveys raises questions about the authenticity of the data collected. Is it ethical? How does it compare to traditional methods like weighting responses?

Transparency and Consent: We agreed that transparency in the use of AI for such purposes is crucial. The ethicality largely depends on how the information is used and whether there’s consent from all parties involved.

Final Thoughts

As technology evolves, so do the methods and ethics of data collection. It’s exciting to think about the future possibilities, but also essential to tread carefully, respecting ethical boundaries and data integrity.

I’d love to hear more thoughts on this – how do you see AI and automation shaping the future of survey data collection?

Feel like you missed out? Come along to our next ASC coffee morning scheduled for Friday 24 November 2023 at 10am. Sign up below

Andrew Le Breuilly – ASC Director and Founder of Arrowstream
https://www.linkedin.com/in/alebreuilly/