How to use the wd.promiseRemote function in wd

To help you get started, we’ve selected a few wd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github springernature / shunter / bin / test-client.js View on Github external
var errors;
		var length;
		var browserName;
		var browserVersion;
		var sessionName;
		var driver;

		count = 0;
		errors = 0;
		length = urls.length;
		browserName = browser.browserName;
		browserVersion = browser.version;
		sessionName = browserName + ' ' + browserVersion;
		browser.name = sessionName;

		driver = wd.promiseRemote('ondemand.saucelabs.com', 80, saucelabsUser, saucelabsKey);
		driver.init(browser)
			.then(iterateTests)
			.fail(function () {
				console.log('Browser ' + sessionName + ' was not available');

				// SauceLabs' shitty API returns browsers that it doesn't support.
				// This hack retries progressively later versions of those browsers
				// until we find one that works or there are no more versions.
				var targetBrowser = {
					browserName: browserName,
					version: Math.floor(parseFloat(browserVersion) + 1)
				};

				saucelabs.getWebDriverBrowsers(retryTests.bind(null, targetBrowser));
			});
github jsdom / jsdom / test / browser-runner.js View on Github external
var opts = {
        port: wdPort
      };

      if (process.env['TEST_SUITE'] === 'browser') {
        wdPort = 4445;

        opts = {
          port: wdPort,
          user: process.env['SAUCE_USERNAME'],
          pwd: process.env['SAUCE_ACCESS_KEY']
        };
      }

      // set up webdriver
      browser = wd.promiseRemote(opts);

      if (argv['verbose-web-driver']) {
        // really verbose wd logging
        browser.on('status', function (info) {
          console.log(info.cyan);
        });
        browser.on('command', function (eventType, command, response) {
          console.log(' > ' + eventType.cyan, command, (response || '').grey);
        });
        browser.on('http', function (method, path, data) {
          console.log(' > ' + method.magenta, path, (data || '').grey);
        });
      }

      if (argv['verbose-browser-console']) {
        browser.on('console', function (detail) {
github montagejs / montage / spec / phantom.js View on Github external
return Apps.file(request, path, contentType, fs);
            }
        });
    };
} else {
    var fileTree = Apps.FileTree;
}

var TESTS_FAILED = {};
var POLL_TIME = 250;

var phantom = spawn("phantomjs", ["--webdriver=127.0.0.1:8910"], {
    stdio: "inherit"
});

var browser = wd.promiseRemote("127.0.0.1", 8910);

var server = joey
.error(true)
.app(fileTree(PATH.resolve(__dirname, "..")))
.server();

server.listen(0).done();

var testPagePort = server.node.address().port;
var testPageUrl = "http://127.0.0.1:" + testPagePort + "/spec/run.html";
console.log("Test page at " + testPageUrl);

// wait for Ghost Driver to start running
Q.delay(2000)
.then(function () {
    return browser.init();
github Jonahss / AppiumRepl / lib / appium-repl.js View on Github external
async function run (config) {
  let desiredCapabilities = await getProfile(config.profiles, config.preselected)

  if (!desiredCapabilities) {
    console.log("desired capabilities not found")
    return
  }

  desiredCapabilities.newCommandTimeout = 0

  console.log("Desired Capabilities: ", JSON.stringify(desiredCapabilities, null, 2));

  let driver = wd.promiseRemote(config.hostname, config.port, config.username, config.password);

  driver.on('status', function (info) {
    console.log(info.cyan);
  })

  driver.on('command', function (meth, path, data) {
    console.log(' > ' + meth.yellow, path.grey, data || '');
  })

  let quit = function () {
    driver.quit(function () {
      process.exit(1);
    });
  };

  let action = new wd.TouchAction(driver);
github uxebu / kommando / src / client / wd-promise.js View on Github external
create: function(capabilities, callback) {
      var client = wd.promiseRemote(url.parse(seleniumUrl));

      client.init(capabilities, function(error, sessionId) {
        this.clients[sessionId] = client;
        if (typeof callback === 'function') {
          callback(error, client, {
            wd: wd
          });
        }
      }.bind(this));
    },
    end: function(callback) {
github kriskowal / asap / scripts / saucelabs.js View on Github external
function runConfiguration(location, annotations, configuration, credentials, saucelabs, timeout) {

    var browser = webdriver.promiseRemote(
        "ondemand.saucelabs.com",
        80,
        credentials.SAUCE_USERNAME,
        credentials.SAUCE_ACCESS_KEY
    );

    browser.on("status", function (info) {
      console.log("WD-STATUS>", info);
    });

    browser.on("command", function(meth, path){
      console.log("WD-COMMAND>", meth, path);
    });

    configuration.name = annotations.name || "job";
    configuration.tags = annotations.tags;
github axemclion / browser-perf / lib / index.js View on Github external
function runOnBrowser(url, browserConfig, opts) {
	browser = wd.promiseRemote(opts.selenium);
	log('Selenium is on %s', browser.noAuthConfigUrl.hostname);
	browser.on('status', function(data) {
		//seleniumLog(data);
	});
	browser.on('command', function(meth, path, data) {
		if (data && typeof data === 'object') {
			var data = JSON.stringify(data);
		}
		seleniumLog(meth, (path || '').substr(0, 70), (data || '').substr(0, 70));
	});

	var metrics = new Metrics(opts.metrics);
	var actions = new Actions(opts.actions);

	return metrics.setup(opts).then(function() {
		return actions.setup(opts);
github axemclion / browser-perf / lib / runner.js View on Github external
Runner.prototype.attachBrowser_ = function(sessionId) {
	if (this.browser === null) {
		this.browser = wd.promiseRemote(this.opts.selenium);
		this.browser.on('status', function(data) {
			//log.debug(data);
		});
		this.browser.on('command', function(meth, path, data) {
			if (data && typeof data === 'object') {
				var data = JSON.stringify(data);
			}
			debug(meth, (path || '').substr(0, 70), (data || '').substr(0, 70));
		});
		return this.browser.attach(sessionId);
	} else {
		return Q();
	}
};