Skip to content

Instantly share code, notes, and snippets.

@secobarbital
Created February 19, 2010 02:44
Show Gist options
  • Save secobarbital/308355 to your computer and use it in GitHub Desktop.
Save secobarbital/308355 to your computer and use it in GitHub Desktop.
/**
* Chickenfoot library to automate DNSMadeEasy
* http://groups.csail.mit.edu/uid/chickenfoot
* http://www.dnsmadeeasy.com
*/
function DnsMadeEasy() {}
// Add a new A record from the Record Listing page
DnsMadeEasy.add_a = function(name, ip, ttl) {
click("Add A Record");
enter("Name:", name);
enter("IP:", ip);
if (ttl) enter("TTL:", ttl);
click("Continue button");
click("Yes button");
}
// Add a MX record from the Record Listing page
DnsMadeEasy.add_mx = function(name, data, level, ttl) {
if (!level) var level = "0";
click("Add MX Record");
enter("Name (Host):", name);
enter("Data (mail server):", data);
enter("MX Level :", level);
if (ttl) enter("TTL:", ttl);
click("Continue button");
click("Yes button");
}
// Add a CNAME record from the Record Listing page
DnsMadeEasy.add_cname = function(name, data, ttl) {
click("Add CNAME Record");
enter("Name:", name);
enter("Data (alias to):", data);
if (ttl) enter("TTL:", ttl);
click("Continue button");
click("Yes button");
}
// Remove the first record with the given name on the Record Listing page
DnsMadeEasy.remove = function(name) {
if ((m = find(new XPath("//a[text()='" + name + "']/../../td/a[text()='Remove']"))).hasMatch) {
click(m);
click("Yes button");
}
}
// Remove all records with the given name on the Record Listing page
DnsMadeEasy.remove_all = function(name) {
while ((m = find(new XPath("//a[text()='" + name + "']/../../td/a[text()='Remove']"))).hasMatch) {
click(m);
click("Yes button");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment