Where my army of robots?
September 12, 2011 1:18 AM   Subscribe

I'd like to automate the creation of online exercises on my company's platform (as in: automatically generated matching, multiple choice, highlighting activities).

Looking for some advice on what programming language(s) to use for a particular task.

The company I work for has an online platform for creating online courses. As such, there are many different templates that a user can use: fill-in-the-blanks, highlighting, multiple choice, etc.

The developers are flat-out busy and cannot help me with this task, so I've got to go it alone (which I'm excited about, since I'd like to learn how to do these sorts of things).

Every time you want to create a new activity, you are brought to a Create/Edit item page. On this page, you enter the activity title, introductory text, and text for interactive tokens (for matching, gap fill, reordering activities, for example).

I'm what you'd call a false beginner when it comes to programming; I took a course on Java in university, this winter I learned some Perl (mostly to familiarize myself with the Mechanize module), and currently I'm studying Python (along with the NLTK).

What I'd like to do is the following:
1. Create xml files from a raw data dump. XML files will be structured to hold data for a particular activity type (i.e., there'd be a structure for matching activities, which contains title, intro text, matching items). This will be fairly easy, I think (once I learn how to use XML!)
2. Using some sort of browser automation, input the data from those XML files onto the online platform.

The idea being, I can automate the creation of activities so that there is no human intermediary, no chance for human error (and it would be much cheaper).

The sort of features that this program would have to deal with are:
1. Plain text fields (Title, number of points a learner is assigned, matching tokens, MC questions).
2. Rich text fields (using a built-in TinyMCE WYSYWIG editor)
3. Newly created fields (i.e., you click a + button and it creates a new Multiple choice question). This was something I couldn't figure out when I was using the Mechanize module.
4. Each item type has a slightly different setup, so I'd have to create a function for each separate type.

Looking at the source code for these pages, I see lots of references to Javascript.

At this point, I'm not interested in uploading images, video, or audio (all of which are supported by the TinyMCE editor). Mostly, I'd like for text to inputted in these fields and then submitted. Eventually, this would be part of a bigger program that would automatically create activities from a transcript, or a csv of words and definitions.

I've started to play around with Selenium, which seems like it might be appropriate (although it seems to be more about regression testing) but I was wondering what some of you experts would do, when faced with a similar task. As I mentioned, I know a bit of Perl and am quickly learning Python.

Curious to hear your thoughts... thanks in advance!
posted by mammary16 to Computers & Internet (2 answers total) 2 users marked this as a favorite
 
Best answer: I've used AutoHotKey, Selenium and iMacros to do web automation, e.g. importing data from csv files and using it to manipulate html widgets (enter text, select stuff). The tricky part used to be importing data and be able to identify and manipulate the widgets. I think you just have to try these tools out and find the one that's the least complex and gets the job done.
posted by Foci for Analysis at 3:22 AM on September 12, 2011


Best answer: Could you do some kind of shell scripting that issues wget requests? Import the data, build URLs, send them out. Incidentally, there are plenty of libraries to parse XML, but not all of them do it well. You might consider storing the data in YAML or a custom format that's easier to parse.

Alternatively, GreaseMonkey might work. I'm not really familiar with it, but I believe it lets you execute JavaScript on a page, and looks like it works with jQuery, so you could view source on the page to figure out how to identify the fields, buttons, etc., then do something like:

jQuery("#add_question_button").click();
jQuery("input[name=question]").val(questions[0]);
jQuery("input[name=answer]").val(answers[0]);
jQuery("#form").submit();

I don't know how the data import would work, but it might be worth looking into.
posted by orangejenny at 6:00 PM on September 14, 2011


« Older Is it ok to choose to (temporarily) not interact...   |   Where to watch US Open in NYC? Newer »
This thread is closed to new comments.