How to " Monkey Test" a website How to " Monkey Test" a website google-chrome google-chrome

How to " Monkey Test" a website


I'd recommend gremlins.js, a "Monkey testing library for web apps and Node.js"

https://github.com/marmelab/gremlins.js

Disclaimer: we wrote it.


Selenium allows you to search the DOM elements in a page, and simulate clicks or keyboard events directed to a certain DOM element. That's not quite the same as defining "non-clicking zones" (which would presumably be defined in terms of X/Y coordinates), but it might possibly be even easier this way.


If you want to roll your own in Python, you could start with

import jsonimport randomimport seleniumSUBDOMAIN = "your-domain.com/subdomain"d = selenium.webdriver.Firefox()d.get("http://" + SUBDOMAIN)while True:    try:        nexturl = random.choice(d.find_elements_by_tag_name("a")).get_attribute("href")    except selenium.common.exceptions.StaleElementReferenceException:        pass    except IndexError:        d.get(random.choice(SEEN))    if nexturl and SUBDOMAIN in nexturl and nexturl not in SEEN:        print(nexturl)        d.get(nexturl)        # some test code for each page        SEEN.append(nexturl)

This starts a browser, loads the URL of your subdomain, and randomly clicks links on the page if the still lead to the subdomain. Write your own code in the while loop to further test each single page.