Element not visible error (not able to click an element)

This is a rather common problem in test automation with selenium. Here are the common solutions: make sure the element you want to click is actually visible. Sometimes you need to make extra actions on a page to make the element visible. For example, open up a dropdown for an option to appear or open … Read more

How to use Protractor with Angular 2?

You can test Angular 2 applications with Protractor (starting from Protractor 2.5.0). For Protractor 5.0.0+, you don’t have to do anything specific, Protractor will auto-detect the Angular version used in the application under test. For Protractor >= 2.5.0 and <= 4.0.14, you would only need to add useAllAngular2AppRoots: true to your config. Here is a … Read more

view console.log output in angular protractor jasmine test

Use browser.manage().logs().get(‘browser’) browser.manage().logs().get(‘browser’).then(function(browserLogs) { // browserLogs is an array of objects with level and message fields browserLogs.forEach(function(log){ if (log.level.value > 900) { // it’s an error log console.log(‘Browser console error!’); console.log(log.message); } }); });

protractor/selenium “could not find chromedriver at” (on Windows)

I was facing this error too and by the time I read the tutorial, it did not cover how to install protractor and the webdriver as local dependencies to your project (which are located in ./node_modules). If this is what you prefer (probably because you might want to use grunt-protractor-runner and run your test later … Read more

Search on descendants of an element

The advantage of separating the child from the child css selector would only be if you’d like to use the parent for something else. Otherwise, it’s slightly faster to do it in one call, like expect(element(‘#parent_1 > .red’)).toBe(‘red’); since Protractor doesn’t need to make two calls to the browser in this case. Another reason to … Read more