 <p>One simple mistake in your approach. </p> <p>The values from JSON are read as string and you are passing a string to <code>element()</code> and not a locator(not a <code>by</code> object)</p> <pre><code>var webElement = element(test.yourName); // Incorrect. test.yourName returns string </code></pre> <p>Change it way and voila ! You should be good. Use eval(). Refer <a href="http://www.w3schools.com/jsref/jsref_eval.asp" rel="nofollow">here</a></p> <pre><code> var webElement = element(eval(test.yourName)); </code></pre>