Skip to content

Commit

Permalink
Fix formFiller gremlin when no form element is present
Browse files Browse the repository at this point in the history
Closes #27
  • Loading branch information
fzaninotto committed Mar 12, 2014
1 parent 4c098e1 commit 5d6448e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/species/formFiller.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ define(function(require) {

do {
// Find a random element within all selectors
element = config.randomizer.pick(document.querySelectorAll(elementTypes.join(',')));
var elements = document.querySelectorAll(elementTypes.join(','));
if (elements.length === 0) return false;
element = config.randomizer.pick(elements);
nbTries++;
if (nbTries > config.maxNbTries) return false;
} while (!element || !config.canFillElement(element));
Expand Down

0 comments on commit 5d6448e

Please sign in to comment.