mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
import * as launch from "launchpad";
|
|
|
|
launch.local(function(error, launcher) {
|
|
launcher.browsers(function(error, browsers) {
|
|
// -> List of available browsers with version
|
|
});
|
|
|
|
const handleInstance = function(err: any, instance: launch.Instance) {
|
|
instance; // -> A browser instance
|
|
instance.id; // -> unique instance id
|
|
instance.stop(() => {}); // -> Stop the instance
|
|
instance.status((err, status) => {}); // -> Get status information about the instance
|
|
};
|
|
|
|
launcher.chrome("https://example.com/", handleInstance);
|
|
|
|
launcher.firefox("http://url", function(err, instance) {
|
|
// An instance is an event emitter
|
|
instance.on("stop", function() {
|
|
console.log("Terminated local firefox");
|
|
});
|
|
});
|
|
});
|
|
|
|
launch.browserstack({
|
|
username : "user",
|
|
password : "password"
|
|
},
|
|
function(err, browserstack) {
|
|
browserstack.browsers(function(error, browsers) {
|
|
// -> List of all Browserstack browsers
|
|
});
|
|
|
|
browserstack.ie("http://url", function(err, instance) {
|
|
// Shut the instance down after 5 seconds
|
|
setTimeout(function() {
|
|
instance.stop(function (err) {
|
|
if (err) {
|
|
console.log(err);
|
|
}
|
|
console.log("Browser instance has stopped");
|
|
});
|
|
}, 5000);
|
|
});
|
|
});
|
|
|
|
launch.remote({
|
|
host : "ie7machine",
|
|
username : "launcher",
|
|
password : "testing"
|
|
}, function(err, api) {
|
|
api.browsers(function(error, browsers) {
|
|
// -> List of all browsers found on ie7machine
|
|
});
|
|
|
|
api("http://github.com", {
|
|
browser : "safari",
|
|
version : "latest"
|
|
}, function(err, instance) {
|
|
});
|
|
});
|