protractor

Get browser.element into page objects with children

≡放荡痞女 提交于 2020-01-13 13:03:50
问题 I am doing testing when I fork a driver instance to send messages between browsers. I also use page objects for mapping the view. In my page objects I have other page objects, some of who inherits from another page object. Though, when I have forked a driver instance and have two browsers to work with, it's troublesome to get the element function from the forked driver in the page objects. Especially for the page object who other PO inherits from. This is a sample from my code: var NavBar =

Protractor: Unable select input element inside a shadow DOM (Polymer) using by.deepCss('input')

↘锁芯ラ 提交于 2020-01-13 04:31:51
问题 Environment: Angular (v5 Application with Polymer Web Components. Protractor for running e2e tests. Angular CLI: 1.6.4 Node: 6.10.0 Angular: 5.2.0 @angular/cli: 1.6.4 typescript: 2.5.3 Below given is my polymer web component shadow root expanded in chrome. You could see input type = "text" inside this custom element. I am unable to access input element inside custom polymer component using protractor by.deepCss . var polymerFirstName = element(by.className('polyFName')); var inputs =

How do I upload a file using protractor

我的未来我决定 提交于 2020-01-13 03:28:28
问题 I'm writing a protractor script that need to upload a JPEG image. I could click on the upload button which opens up a windows file selector. But, then I need to write the path to a file in that File Selector dialog using protractor. But, i have no idea how it works. I tried just typing the path using sendKeys and it doesn't work so far. Anyone have an idea how to do this? Thanks. :) 回答1: Try my answer here. If you need a quick solution try following solution. // set file detector var remote =

Protractor Failed: element not interactable

妖精的绣舞 提交于 2020-01-13 02:13:27
问题 I am running an E2E test for an Angular 7.x app. The test runs straight forward on my local machine. But when I push it on the repo (GitLab), then pipeline fails and throws following error: USER PROFILE - Check and change PROFILE - Failed: element not interactable (Session info: chrome=71.0.3578.80) (Driver info: chromedriver=2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5),platform=Linux 4.14.74-coreos x86_64) Test Case: it('USER PROFILE - Check and change PROFILE', () => { page

How to set HTML5 type=“date” input fields (e.g. in Chrome) using Selenium/Protractor?

北城余情 提交于 2020-01-12 14:10:45
问题 I want to update the date value (displayed as mm/dd/yyyy with only the number portions modifiable) of some HTML5 date form fields: <input type="date"/> in my Selenium/Protractor tests. I've tried using sendKeys for this but (on Chrome) have not been successful so far. Is there a way to do this using sendKeys ? Or some other way to do it? 回答1: Using Chrome on Mac with Protractor, the following approach has worked for me. Template (html5) <input type="date" placeholder="Due Date" ng-model=

recording videos of Protractor e2e tests

不想你离开。 提交于 2020-01-12 10:54:08
问题 I use Protractor and gulp to test an angular application. I'm looking for a way to record videos for my Protractor e2e tests so that I can play them back as .mp4 or whatever other forms that can be opened on Windows 10. Has anyone accomplished this? Could you suggest maybe some useful links or code? 回答1: There's an npm package that allows you to record protractor e2e tests using ffmpeg binaries: https://www.npmjs.com/package/protractor-video-reporter It also generates subtitles with each spec

recording videos of Protractor e2e tests

六月ゝ 毕业季﹏ 提交于 2020-01-12 10:53:11
问题 I use Protractor and gulp to test an angular application. I'm looking for a way to record videos for my Protractor e2e tests so that I can play them back as .mp4 or whatever other forms that can be opened on Windows 10. Has anyone accomplished this? Could you suggest maybe some useful links or code? 回答1: There's an npm package that allows you to record protractor e2e tests using ffmpeg binaries: https://www.npmjs.com/package/protractor-video-reporter It also generates subtitles with each spec

Using CSS selectors instead of XPath locators when searching through siblings

前提是你 提交于 2020-01-11 09:24:12
问题 Currently, I have the following page object fields: this.filterTeamDropdown = $("filter-item-edit .dropdown button"); this.teams = this.filterTeamDropdown.all(by.xpath("following-sibling::ul//li[contains(@class, 'dropdown-list-item')]")); Is there a way to replace the XPath locator for the teams field and have a CSS selector instead? The motivation for it is coming from the Style Guide and the recommendation not to use XPaths. From what I understand, it is impossible to have a CSS selector to

How to set focus on a section of my web page then scroll down

核能气质少年 提交于 2020-01-11 08:19:06
问题 using protractor I would like to first set focus on a left pannel in my web page then scroll down in order to click on a filter. Any idea how to do this using protractor syntax? Here is my HTML : <section id="filters" style="height: 266px; overflow: hidden;" tabindex= "5076"> <div class="ng-binding" id="currentSearchTitle"> Current search </div> <div id="currentSearch"> <div id="searchBlock"> <div id="jobTypeBlock"> <div class="ng-binding" id="jobTypeTitle"> Filter by job type </div> <div

Understanding protractor's use of promises

核能气质少年 提交于 2020-01-11 07:16:14
问题 Essentially I am playing around with getting a library for preconditions set up (think user creation). As protractor is promise-based and magically does all the wrapping to keep things in order, I thought of using promises for that purpose. I wrote a little sample code but I cannot explain the observed behaviour so maybe someone can help me understand what's going on. function timeout(ms) { var promise = protractor.promise.defer(); setTimeout(function() { console.log('qwer'); promise.fulfill