javascript - How to you configure Selenium Webdriver to take in command line options with Node.js? -
i have following resources, i'm not sure how interpret them particular goal (this , this). i'm using selenium webdriver through node.js, , far, tests work wish, wish add command line options make more dynamic. stands now, test file called mytests.js. start these tests, run following command in terminal.
node mytests.js
this starts 100+ tests. problem these take quite while complete. maybe 45 minutes 1.5 hours. i'd add options choose test, or set of tests run, based on input command line. goal have this:
node mytests.js targetname
so, in mind, 'targetname' focus on , apply tests related given target/url. example. start of test file appears such:
var webdriver = require('selenium-webdriver'), = webdriver.by, until = webdriver.until; var chrome = require('selenium-webdriver/chrome'); var path = require('chromedriver').path; var service = new chrome.servicebuilder(path).build(); chrome.setdefaultservice(service); var driver = new webdriver.builder() .forbrowser('chrome') .build(); driver.manage().logs().get('browser'); // . . .
what can add these make possible add in command line options? can please provide example in javascript instead of links other pages?
a friend of mine directed me process.argv variable. gave me needed solve problem. :)
so, adding following mytest.js:
console.log(process.argv);
will echo follow console.
$ node mytests.js command [ 'mytests.js', 'this', 'is', 'a', 'command' ]
Comments
Post a Comment