Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture screenshot from Android emulator #28

Open
deyanyanakiev opened this issue Mar 4, 2015 · 0 comments
Open

Capture screenshot from Android emulator #28

deyanyanakiev opened this issue Mar 4, 2015 · 0 comments

Comments

@deyanyanakiev
Copy link

Hello,
I was wondering if you could give me some advice on how to capture a screenshot from the android emulator.
I am working with protractor and appium for connecting to the emulator. Here is the code which I have so far:

var fs = require('fs'),
    adbClient = require('adbkit').createClient();

function writeScreenShot(data, filename) {
    var stream = fs.createWriteStream(filename);
    stream.write(new Buffer(data, 'base64'));
    stream.end();
}

describe('angularjs homepage todo list', function() {
  it('should add a todo', function() {
    browser.get('http://www.angularjs.org');

    browser.findElement(by.id('add-some-control'))
        .then(function (el) {
            return el.getLocation();
        }).then(function (loc) {
            return browser.executeScript('window.scroll(0,' + loc.y + ')');
        }).then(function () {
            return adbClient.listDevices();
        }).then(function (devices) {
            console.log(devices[0].id);
            return adbClient.screencap(devices[0].id);
        }).then(function (png) {
            writeScreenShot(png, 'screen.png');
        });

    var todoList = element.all(by.repeater('todo in todos'));
    expect(todoList.count()).toEqual(2);
  });
});
pimterry pushed a commit to httptoolkit/adbkit that referenced this issue Dec 13, 2021
Bumps [node-forge](https://github.com/digitalbazaar/forge) from 0.9.2 to 0.10.0. **This update includes a security fix.**
- [Release notes](https://github.com/digitalbazaar/forge/releases)
- [Changelog](https://github.com/digitalbazaar/forge/blob/master/CHANGELOG.md)
- [Commits](digitalbazaar/forge@0.9.2...0.10.0)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant