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

Unknown error: cannot take screenshot #64

Open
chirkovevgeny opened this issue Jul 29, 2015 · 4 comments
Open

Unknown error: cannot take screenshot #64

chirkovevgeny opened this issue Jul 29, 2015 · 4 comments

Comments

@chirkovevgeny
Copy link

I am getting an error when execute the tests that involves opening new browser tab. Below is the stacktrace:

UnknownError: unknown error: cannot take screenshot
from unknown error: Failed to capture tab: unknown error
JavaScript stack:
Error: Failed to capture tab: unknown error
    at checkForExtensionError (chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/background.js:14:17)
    at Object.callback (chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/background.js:37:5)
    at safeCallbackApply (extensions::sendRequest:21:15)
    at handleResponse (extensions::sendRequest:72:7)
  (Session info: chrome=44.0.2403.125)
  (Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Mac OS X 10.9.5 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 100 milliseconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
@eddiemonge
Copy link

are you switching to that tab?

@chirkovevgeny
Copy link
Author

Yes I switch to that tab to validate URL

@eddiemonge
Copy link

What is the code you are using to do that? Also, you should wrap your code in triple backticks so it formats correctly and is easier to read.

@chirkovevgeny
Copy link
Author

@eddiemonge , thank you for fast response, I have formatted the post to be more readable, thanks for pointing out. Here is the code that handles windows switches:

    this.closeNewSocialWindow = function(socialItem) {

        var isPopUpShowed = function(){
            return browser.driver.getAllWindowHandles().then(function(handles){
                return handles.length>1;
            });
        };

        browser.wait(isPopUpShowed,timeout).then(function(){
            browser.wait(browser.driver.getAllWindowHandles(),timeout).then(function (handles) {
                var originalWindow = handles[0];
                var popUp = handles[1];
                browser.switchTo().window(popUp);
                browser.getWindowHandle().then(function(handle) {
                    expect(handle).toBeDefined();
                    expect(handle).toEqual(popUp);
                    browser.wait(browser.driver.getCurrentUrl(),timeout).then(function(url) {
                        expect(url).toContain(socialItem.toLowerCase()+'.com');
                        browser.wait(browser.driver.close(),timeout).then(function(){
                            browser.switchTo().window(originalWindow);
                        });
                    });
                });
            });
        });
    };

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

2 participants