protractor

Upload file to hidden input using protractor and selenium

大兔子大兔子 提交于 2019-12-20 01:43:59
问题 I've got a hidden file input field like this: <input type="file" id="fileToUpload-1827" multiple="" onchange="angular.element(this).scope().setFiles(this)" data-upload-id="1827" class="hidden-uploader"> I'd like to be able to upload files to this. The normal way to do this in protractor would be to do: ptor.findElement(protractor.By.css('.file-upload-form input')).sendKeys('/path/to/file') But because the input element isn't visible, I get an error. I tried: ptor.driver.executeScript("return

protractor angularJS global variables

你说的曾经没有我的故事 提交于 2019-12-20 01:34:24
问题 I'm using protractor with angularjs to create my e2e tests. I have many files for which my specs array is quite big and I want to share a common function across all files. Is there a way to create a global beforeEach of some sort where I can inject my function? Does the exports.config object expose something so that I can have a common variable across all files? Currently I'm piggy backing off the "browser" variable but that can potentially be dangerous. Any help is much appreciated. Thanks

Not able to click on hidden element in protractor?(Please go through the image.)

瘦欲@ 提交于 2019-12-19 11:57:20
问题 Here is the HTML code : <li class="subdropdown"> <a href="" class="submenu-toggle">Create Position</a> <ul class="list-unstyled dropdown-submenu" role="menu"> <li style="cursor: pointer;"> <a ng-click="openPositionModal($event)"><i class="glyphicon glyphicon-list-alt"></i> New Position</a> </li> Here is my test case: 1) Move the cursor on "Create position" toggle menu. 2) After the mouse hover, click on the "New position" menu list. 回答1: browser.actions(), "by link text" and the "by partial

Selecting angular-ui date-picker value from the calendar using Protractor

偶尔善良 提交于 2019-12-19 11:32:09
问题 My datepicker structure looks like: <button type="button" class="date-picker-item"> <span>1</span> </button> <button type="button" class="date-picker-item"> <span>2</span> </button> etc.. I am trying to use by.cssContainingText from the protractor api. element.all(by.cssContainingText('.date-picker-item > span', day)) but its not selecting it at the minute. Do I need to target this a different way? Thanks a lot in advance. 回答1: In one of my project i wrote function like this: elementDate:

Checking if an object is a promising function

假装没事ソ 提交于 2019-12-19 10:15:13
问题 In protractor.js, I have functions that promise/defer. For example var myFunc = function(_params) { var deferred = protractor.promise.defer(); /***do magical code things****/ /***wait for other promises***/ /*****deferred.fulfill();*****/ return deferred.promise; }; What sort of combinations of typeof statements can I use to check if this thing (when passed to something else) promises? typeof promiseMaybe === 'function' typeof promiseMaybe.then === 'function' && 'ed with prior? Or is there a

How to close the current tab of the browser in protractor with out closing the complete browser

岁酱吖の 提交于 2019-12-19 09:54:02
问题 In the application i have two options "Google , Twitter" . When i click on any option it will open in new tab. In my test case , i would like to click on google or twitter option and close the google or twitter tab and return back to the my application. Is there any way to close only newly opened tab. I tried below solutions. browser.close(); it is closing the entire browser Can any one help me how to close only tab of the browser ( in my case google tab or twitter tab) with out closing the

How to assign count of rows or getText to a variable in Protractor

此生再无相见时 提交于 2019-12-19 09:28:16
问题 Here is my code: describe('SuperCalculator Page', function() { beforeEach(function(){ browser.get('http://juliemr.github.io/protractor-demo/'); }); it('get rows count and firs column value', function() { element(by.model('first')).sendKeys(1); element(by.model('second')).sendKeys(2); element(by.id('gobutton')).click(); element(by.css('table[class=\'table\']')).all(by.css('tr')).count().then(function(rowCount) { counttim = rowCount; console.log(counttim); }); element(by.css('table[class=\

debugging protactor (with / without webstorm)

允我心安 提交于 2019-12-19 09:08:33
问题 So I'm starting out with protractor, and I want to debug my test code: describe('stuff', function(){ it('should find the specs item, and its empty', function(){ browser.debugger(); gotoHome(); var allItems = element.all('li in model.tags'); var specsDashboardElement; for (var i=0 ; i < allItems.length; ++i) { var elem = allItems[i]; var text = elem.findElement(by.css('.li-title').getText()); // does this even work?? dunno if (text == "Specs") specsDashboardElement = elem; } expect

Unable to copy file from docker-compose mount to host

时间秒杀一切 提交于 2019-12-19 08:30:52
问题 I am unable to copy a file generated by my Selenium tests in a folder inside docker container mounted to host machine. Here is how my compose file look like selenium: image: 'selenium/standalone-chrome' expose: - "4444" tests: build: context: ./tests dockerfile: Dockerfile depends_on: - selenium - web volumes: - /testResultsReport:/testResultsReport This is how my directory structure looks like. \ - docker-compose.yml - build scripts - tests - testResultsReport - Test scripts Name of the file

Download file on Firefox with protractor

二次信任 提交于 2019-12-19 08:01:19
问题 I need to download a zip file on Firefox with protractor. On clicking on download link, Windows dialog asking to Open/Save the file pops up. So How can I handle that. What args do I need to pass to driver? With chrome I can do that with download: { 'prompt_for_download': false }, but what should i do with firefox. 回答1: The problem is - you cannot manipulate that "Save As..." dialog via protractor/selenium . You should avoid it being opened in the first place and let firefox automatically