A jasmine spec has timed out: resetting Webdriver control flow

3,587 views
Skip to first unread message

umar kayani

unread,
Jul 17, 2014, 5:27:42 AM7/17/14
to jasmi...@googlegroups.com
Hi Guys

I seem to have come across an issue regarding Jasmine (specifically using ProtractorJS for end-to-end AngularJS testing)

I've got 2 spec files and 1 central config file that runs them both

// config

// conf.js
exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['spec.js', 'fileupload.js'],
  allScriptsTimeout: 20000,
  //chromeDriver: 'C:/Users/umark/AppData/Roaming/npm/node_modules/protractor/selenium/chromedriver'
  //chromeDriver: 'C:/Users/umark/AppData/Roaming/npm/node_modules/protractor/selenium/chromedriver.exe'
 
  // Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 100000,
    isVerbose: true
  }
};

//first spec

// spec.js
describe('loginsite', function () {
    it('should login', function () {
        browser.driver.get('http://mysite.com');
        browser.driver.findElement(by.name('UserName')).sendKeys('xxxxx');
        browser.driver.findElement(by.name('Password')).sendKeys('xxxxxx');
        browser.driver.findElement(by.id('logIn')).click();

expect(browser.driver.findElement(by.id('topUsername')).getText()).toContain('xxxxx');
});
});

//second spec

// File Upload spec
describe('File Upload', function() {
    it('should upload a file', function () {
   browser.driver.get('http://mysite.com');
        browser.driver.findElement(by.name('UserName')).sendKeys('testuser');
        browser.driver.findElement(by.name('Password')).sendKeys('password');
        browser.driver.findElement(by.id('logIn')).click();
        browser.driver.findElement(by.id('upload')).click(); 
browser.driver.findElement(by.name('FileToUpload')).sendKeys("C:\myfile.csv"); 
browser.driver.findElement(by.xpath('html/body/div[1]/div[7]/div[2]/div/button[2]/span')).click(); 
console.log('file has been uploaded');
        });
});

However when I run protractor config.js, i get the following error


  should login - pass
file has been uploaded
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
The last active task was:
unknown
File Upload
  should upload a file - fail
Failures:

  1) File Upload should upload a file
   Message:
     NoSuchElementError: no such element
  (Session info: chrome=35.0.1916.153)
  (Driver info: chromedriver=2.10.267521,platform=Windows NT 6.1 SP1 x86_64) (WA
RNING: The server did not provide any stacktrace information)
Command duration or timeout: 7 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/
no_such_element.html
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'PLLPC6197', ip: '10.5.1.252', os.name: 'Windows 7', os.arch:
 'amd64', os.version: '6.1', java.version: '1.6.0_35'
Session ID: 7a7fe2c8dec4042fc27d3570107d7f56
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browser
Name=chrome, chrome={userDataDir=C:\Users\umark\AppData\Local\Temp\scoped_dir250
72_2479}, rotatable=false, locationContextEnabled=true, version=35.0.1916.153, t
akesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesA
lerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled
=true, applicationCacheEnabled=false, takesScreenshot=true}]
   Stacktrace:
     NoSuchElementError: no such element
  (Session info: chrome=35.0.1916.153)
  (Driver info: chromedriver=2.10.267521,platform=Windows NT 6.1 SP1 x86_64) (WA
RNING: The server did not provide any stacktrace information)
Command duration or timeout: 7 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/
no_such_element.html
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'PLLPC6197', ip: '10.5.1.252', os.name: 'Windows 7', os.arch:
 'amd64', os.version: '6.1', java.version: '1.6.0_35'
Session ID: 7a7fe2c8dec4042fc27d3570107d7f56
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browser
Name=chrome, chrome={userDataDir=C:\Users\umark\AppData\Local\Temp\scoped_dir250
72_2479}, rotatable=false, locationContextEnabled=true, version=35.0.1916.153, t
akesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesA
lerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled
=true, applicationCacheEnabled=false, takesScreenshot=true}]
    at new bot.Error (C:\Users\umark\AppData\Roaming\npm\node_modules\protractor
\node_modules\selenium-webdriver\lib\atoms\error.js:109:18)
    at Object.bot.response.checkResponse (C:\Users\umark\AppData\Roaming\npm\nod
e_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:106:9
)

Any ideas why the error is thrown?

P.S. sorry about the terrible formatting of the error / code paste

If you need any other info please let me know 

Thanks

Julie Ralph

unread,
Jul 17, 2014, 2:44:10 PM7/17/14
to jasmi...@googlegroups.com
This is a Protractor issue - Protractor treats timeout issues specially (since it needs to make sure that the control flow is clean for the next test), but the error messages that internet explorer gives are tricking it. Issue is logged at https://github.com/angular/jasminewd/issues/8 and should be fixed shortly.


--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jasmine-js+...@googlegroups.com.
To post to this group, send email to jasmi...@googlegroups.com.
Visit this group at http://groups.google.com/group/jasmine-js.
For more options, visit https://groups.google.com/d/optout.

Julie Ralph

unread,
Jul 17, 2014, 2:45:09 PM7/17/14
to jasmi...@googlegroups.com
I should note that your root issue is that your element can't be found.

umar kayani

unread,
Jul 23, 2014, 4:31:28 AM7/23/14
to jasmi...@googlegroups.com
Hey Julie

Thanks a lot for replying 

Ok so the spec timed out, is actually a protractor issue? How can I keep up with fixed issues?

Thanks

Julie Ralph

unread,
Jul 23, 2014, 1:54:52 PM7/23/14
to jasmi...@googlegroups.com
All issues go through the github issue tracker: https://github.com/angular/protractor/issues?state=open

This has now been fixed in the latest version - the reported error should be less confusing now.

umar kayani

unread,
Jul 24, 2014, 3:11:20 AM7/24/14
to jasmi...@googlegroups.com
Issue fixed by upgrading to protractor v1.0.0 :)

shanmuga Mahalingam

unread,
Nov 4, 2014, 6:39:56 AM11/4/14
to jasmi...@googlegroups.com
I got latest version of protractor and i am still seeing this issue - While running on Firefox.Same works fine on Chrome

Tanu Yadav

unread,
Sep 8, 2016, 12:32:31 PM9/8/16
to Jasmine
I have protractor version on one windows machine as 2.1.1

and it gives error for both chrome and firefox where as my other windows machine i have protractor version 2.5.1 There its working fine on both the browsers.

Indu Gupta

unread,
Jun 29, 2018, 3:28:59 PM6/29/18
to Jasmine
Hi,
I am also facing this issue and struggling from 2 days. I have latest version of node and protractor
Pls reply if any solution 
Reply all
Reply to author
Forward
0 new messages