Selenium WebDriver Recipes in Node.js by Zhimin Zhan

Selenium WebDriver Recipes in Node.js by Zhimin Zhan

Author:Zhimin Zhan [Zhimin Zhan]
Language: eng
Format: epub, pdf
Publisher: leanpub.com
Published: 2016-07-08T00:00:00+00:00


By creating some utility functions (you can find in source project), we can get quite readable test scripts as below:

getRandomString(7); // example: "dolorem" getRandomwords(5); // example: "sit doloremque consequatur accusantium aut" getRandomSentences(3); getParagraphs(2);

15.6 Get a random string in a collection

function getRandomStringIn(array) { return array[Math.floor(Math.random() * array.length)]; } it("Random string in collection", function() { var allowableStrings = ["Yes", "No", "Maybe"]; // one of these strings driver.findElement(By.name("username")).sendKeys(getRandomStringIn(allowableStrings)); });



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.