Search Posts

Category: automated-tests

Variable loses the assigned value in Protractor test

I am running a protractor test that should check whether a record lives in the grid with a specific licence number. However after going through all the rows it loses the assigned value to the rowNumber variable. Not sure why it’s doing that. rowNumber should equal to the index. This is my test. var rowNumber = null; var rows = element.all(by.repeater(‘(rowRenderIndex, row) in rowContainer.renderedRows track by $index’)); it(‘should find row the created Driver Licence lives […]

Can I run Firefox’s Responsive Design Mode in Protractor?

I’m using mobileEmulation for Chrome testing my app but I’ve realised Firefox has a Responsive Design Mode which simulates a mobile device. Is it possible to add a parameter to run that mode in protractor? For Chrome we can write this in conf.js multiCapabilities: [ { browserName: ‘chrome’, chromeOptions: { mobileEmulation: { deviceName: getDeviceFromParams() } } } ] What about Firefox? Source: AngularJS

Why I can’t get the text for this element

I am trying to test some search function in a webpage. and if no result return, the page shows text “no result“. I can see the text, but my test code can’t get the value. I tried document.querySelector(“div[class=’bold ng-binding’]”).text; document.querySelector(“div[class=’bold ng-binding’]”).innerHTML; document.querySelector(“div[class=’bold ng-binding’]”).value; Nothing works. it always returns “None”. The Element looks like this: <div ng-show=”expanded && !show” class=”bold ng-binding”>No Result</div> Source: AngularJS

Protractor unable to find element by id but css works fine

I have a div with ui-grid in it. Somehow I’m able to locate it by css but not by id. This is my html <div ui-grid=”vm.licenceGrid” ui-grid-resize-columns ui-grid-selection class=”root-ui-grid tab-grid top5″ id=”driver-licences-grid”></div> and one of my tests it(‘should switch to Licences tab’, function() { element(by.css(‘[ui-sref=”main.driver.licences”]’)).click(); //expect(element(‘driver-licences-grid’)).isPresent()).toBeTruthy(); expect(element(by.css(‘.tab-grid’)).isPresent()).toBeTruthy(); }); Commented line doesn’t work whereas the uncommented one works absolutely fine. I’ve even tried waiting for the element to load but it doesn’t make any difference. @edit […]

ExecuteScript not working with AngularJS form and Protractor

Used below codes to automate a login form. Form is built in AngularJS and I am using Protractor Framework. After filling textbox and clicked submit button; I am getting error that both textbox are empty. Used wait also. sendkeys is working fine, but its taking time to input larger forms; so I am expecting to use executeScript. HTML Code: <input id=”email” class=”form-control ng-pristine ng-valid ng-touched” type=”text” ng-keypress=”logindata($event)” ng-model=”email” placeholder=”Email ID” value=”” name=”email”> <input id=”pass” class=”form-control […]

JavascriptExecutor is not working with AngularJS forms

I am trying to automate a login form by Selenium Webdriver (JavascriptExecutor) which is built in AngularJS. The script is entering data in textbox; but when submit button is clicked error message shows that textbox is not filled. I have also used events like onkeyup(), blur(); but error shows these are not functions. Textbox validation works fine with sendkeys() and it takes time; but facing issue when JavascriptExecutor is used. html code: <input id=”email” […]

How to test Handsontable with virtual scrolling in Angular App using Protractor?

We use Handsontable in a hybrid AngularJS / Angular app that we test using Protractor. As far as I know we don’t use the available Angular wrapper for Handsontable but instead use it directly. Typical actions we would like to do in a fast way: Expand all collapsed columns in the table Read value of cell (x,y) Read all values in row y Change the value in cell (x,y) Currently we have two approaches to […]

browser.wait() does not work when there is no spinner in ProtratorJs Test

I am facing very weird behaviour of browser.wait(). In my test website sometime Spinner appear and sometime it does not appear to handle this situation I am using browser.wait(). But when there is no spinner appears in the page in that condition my code is not working and throwing exception. Can you please help me to resolve this issue. How I can make sure that if there is no spinner execution will continue if there […]