Socket
Socket
Sign inDemoInstall

min-wd

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

min-wd - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

42

lib/driver.js

@@ -64,6 +64,2 @@ /*

function execute(context, script, callback) {
if (!script) {
close(context, callback);
return;
}
request(context, 'POST', '/execute', {

@@ -86,2 +82,21 @@ script : script,

function openUrl(context, script, callback) {
var url = context.url;
if (url) {
request(context, 'POST', '/url', {
url : url
}, function (err) {
if (err) {
close(context, function () {
callback(err);
});
return;
}
execute(context, script, callback);
});
} else {
execute(context, script, callback);
}
}
function connectBrowser(context, callback) {

@@ -122,2 +137,3 @@ var json = {

port : options.port,
url : options.url,
basePath : '/wd/hub',

@@ -154,5 +170,11 @@ browser : browser,

input.on('end', function () {
requests.forEach(function (request) {
execute(request.context, script, request.callback);
});
if (!script) {
requests.forEach(function (request) {
close(request.context, request.callback);
});
} else {
requests.forEach(function (request) {
openUrl(request.context, script, request.callback);
});
}
requests = null;

@@ -165,3 +187,7 @@ });

} else {
execute(context, script, callback);
if (!script) {
close(context, callback);
return;
}
openUrl(context, script, callback);
}

@@ -168,0 +194,0 @@ };

4

package.json
{
"name" : "min-wd",
"version" : "0.2.0",
"version" : "0.3.0",
"description" : "Minimal WebDriver that pipes stdin to browsers",

@@ -23,3 +23,3 @@ "keywords" : ["webdriver", "stdin", "browser", "tests", "browserify", "browserify-transform"],

"listen" : "~1.0.0",
"brout" : "~0.1.0"
"brout" : "~0.1.2"
},

@@ -26,0 +26,0 @@ "devDependencies" : {

# Minimal WebDriver
Pipes stdin to all configured browsers using the [WebDriver protocol][].
Pipes stdin to all configured browsers using the Selenium
[WebDriver protocol][].

@@ -49,2 +50,16 @@ Repository: <https://github.com/mantoni/min-webdriver>

### Loading a web page
By default, min-wd will folk a new browser and inject the given script straight
away without loading any web page. If you want to run your test cases in the
context of a web page, you can configure the start page in the `.min-wd` file:
```
{
"url": "http://my-test-page"
}
```
### Mocha Support
Testing with [Mocha][] requires [mocaccino][]:

@@ -56,2 +71,20 @@

### IE trouble shooting
This might cause trouble with IE where it
reports it can't find `JSON`. The Selenium default page makes IE switch to
quirks mode. To avoid this load a web page as described above.
Here is a minimal node server that does the job:
```js
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end('<!DOCTYPE html><html><head><meta encoding="utf-8"></head>'
+ '<body></body></html>');
}).listen(4445);
```
## License

@@ -58,0 +91,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc