Is Protractor compatible with Angular Material dialog popups?

Encountering an issue targeting elements in a popup dialog using Protractor. Once the popup dialog appears, the following error is displayed:

Failed: unknown error: Element is not clickable at point (1204, 32). Other element would receive the click...

I am still relatively new to Angular and Protractor, and I have attempted to find similar instances of this problem. Below is the JavaScript code:

it('should create a case and wait for the case page to load',  function(){
    casePage.goToCasesPage();
    var createCaseBtn = element(by.id("create-case-btn"));
    createCaseBtn.click();
    var stdCaseTypeBtn = element(by.css('[ng-click="vm.createCase($event, \'standard\')"]');
    expect(stdCaseTypeBtn);
    stdCaseTypeBtn.click().then(function(){
        browser.getAllWindowHandles().then(function(handles){
            var popUpDialog = handles[1];
            browser.switchTo().window(popUpDialog).then(function(){
                var oeUtils = require('../common/utils');
                console.log("switched");

                //Fill the crud form and click create
                var caseTitle = element(by.model('case.title'));
                var caseDescription = element(by.model('case.description'));
                var okDialogBtn = element(by.id('create-case-dlg-btn'));

                var caseTxtTitle = oeUtils.generateRandomString(8);
                caseTitle.sendKeys(caseTxtTitle);
                caseDescription.sendKeys(oeUtils.generateRandomString(20));
                okDialogBtn.click();

                expect(element(by.binding('case["cm:title"]')).getText()).toEqual(caseTxtTitle);
            });
        });

    });

})


The HTML template (the actual popup):

<md-dialog aria-label="Case edit dialog">
  <form name="form">
    <md-toolbar layout="row">
      <div class="md-toolbar-tools">
        <h2 ng-hide="editCase">{{ 'CASE.CREATE_CASE' | translate }}</h2>
        <h2 ng-show="editCase">{{ 'CASE.EDIT_PROPERTIES' | translate }}</h2>
      </div>
    </md-toolbar>
    <md-dialog-content style="max-width:800px;max-height:810px;min-width:20em;">

      <md-input-container>
        <label><span class="md-warn">*</span> {{ 'CASE.TITLE' | translate }}</label>
        <input type="text" ng-model="case.title" required focus-me>
      </md-input-container>

      <md-input-container>
        <label>{{ 'CASE.DESCRIPTION' | translate }}</label>
        <textarea ng-model="case.description"></textarea>
      </md-input-container>

    </md-dialog-content>
    <div class="md-actions" layout="row">
      <md-button id="create-case-dlg-btn" type="submit" class="md-primary" ng-click="vm.update(case)" ng-disabled="form.$invalid">
        {{ 'COMMON.OK' | translate }}
      </md-button>
      <md-button type="button" ng-click="vm.cancel(form)">
        {{ 'COMMON.CANCEL' | translate }}
      </md-button>
    </div>
  </form>
</md-dialog>

Answer №1

Here is some helpful information.

Take a look at the example below with md-dialog:

<md-dialog aria-label="Page Preference Dialog" class="page-pref-dialog confirmation-dialog">
    <md-dialog-content class="dialog">`enter code here`
        <div class="dialog-body bold confirmation-dialog-body">
            <form name="confirmationForm">
                <div>
                    <h4>{{'Admin_viewQuestionnaire_popup_confirm_inactive'|translate}}</h4>
                </div>
            </form>
        </div>
        <div class="dialog-footer">
            <button type="button" id="admin_dialog_confirm_cancel" class="btn ink-reaction btn-primary" ng-click="cancelDialog()">{{"Admin_commonButton_button_cancel"| translate}}</button>
            <button type="button" id="admin_dialog_confirm_deactivate_user" class="btn ink-reaction btn-primary" ng-click="closeDialog()">{{'Admin_user_btn_viewUser_Deactivate'|translate}}</button>
        </div>
    </md-dialog-content>
</md-dialog>

Test case:

    it( "view user", function () {
        browser.get( loginPageUrl );
        element( by.model( 'pageData.loginData.userName' ) ).sendKeys( adminUsername );
        browser.driver.sleep( 500 );
        element( by.model( 'pageData.loginData.userPassword' ) ).sendKeys( adminPassword );
        browser.driver.sleep( 500 );
        element( by.id( 'login-btn' ) ).click();
        browser.waitForAngular();
        element( by.id( 'admin_dialog_confirm_deactivate_user' ) ).click();
        console.log("success");
        browser.driver.sleep( 1500 );
    } );

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the purpose of re-checking the user in the passport.deserializeUser function?

After reading multiple articles on how to utilize passport.js, I'm left wondering why user verification is repeated within the passport.deserializeUser function. The code snippet looks like this: passport.deserializeUser((id, done) => { console. ...

modifying the IP address used while making a jQuery request

I am currently working on integrating a payment system, but unfortunately, I do not have a static IP address and my country is restricted. I am using my personal hosting with the whitelisted IP, however, it seems like the initial request to their servers ...

What is the best way to activate an @keyframe animation based on the scrolling action?

I am currently working on an @keyframe animation that rotates a circle along its x-axis, starting from 0 degrees to 90 degrees and then back to 0 degrees. My objective is to synchronize the rotation of the circle with the user's scrolling movement on ...

Side menu and grid display using HTML and CSS

Looking to revamp the layout of my angularJS website, specifically one page. Currently, information is displayed in a table format but I would like to switch it up by adding a left sidebar featuring a list of names (tiles). When a user clicks on a name, th ...

Invoking a React function repeatedly (every second)

Currently, I am working with React and utilizing Material UI to create a modal. The modal is rendered as part of the body of the code, placed at the bottom of the page. Its visibility is controlled by the state; if it's open or closed. However, I&apos ...

Ways to detach event listener in Vue Component

One of my Vue2 components has a custom eventListener that I added in the mounted lifecycle hook. I am now trying to figure out the correct way to remove this listener when the component is destroyed. <template> <div> ... </di ...

Issues with tooltipTemplate functionality within Chart.js

I've been experimenting with a bar graph in Chart.js, and I'm attempting to implement custom tooltips. After doing some research, it appears that adding tooltipTemplate: "<%= value %>% test" to my options section should append the word & ...

Utilizing Angular to intercept AJAX requests, verifying internet connectivity before proceeding with sending the request

In my Angular (with Ionic) app, I have this code snippet: my_app.factory('connectivityInterceptorService', ['$q', '$rootScope', function ($q, $rootScope) { var connectivityInterceptorServiceFactory = {}; var _request ...

Python selenium Element is unclickable due to the presence of another obscuring element

The code below is causing an issue: timePicker = browser.find_element_by_xpath('//*[@class="time hasTimepicker"]') An exception is thrown: selenium.common.exceptions.ElementClickInterceptedException: Message: Element <input id=" ...

useEffect runs endlessly

Currently, I am using React with hooks to handle API calls and implement autoscroll functionality on a data-heavy screen. However, I have encountered a problem where the autoscroll feature implemented through a separate useEffect is interfering with the ot ...

Tips for displaying a message when clicking on the second level in fancytree.js

I'm looking to use fancytree.js to display an alert message only when clicking on nodes in the second level. For example: <ul> <li>1</li> <ul> <li>1.1</li> ...

Verify whether the division contains any elements and does not include specific elements

I previously opened a similar thread, but with the condition that the div does not contain a second element within it. So my previous question was as follows: I have some code that looks like this: <p class="elementWrap"> <label>Phone</l ...

Is Selenium the Best Method for Scraping Websites and Extracting Table Data? How to effectively handle the output of a list DataFrame?

Looking for advice from a pandas expert. I'm currently navigating a webpage and opening tables by clicking on buttons to scrape data as read_html() is not working for me. Check out my code snippet; elem = sesh.find_element_by_xpath(f'{gen_butto ...

In order of service - avoid repeating the initial service upon the next user click if the second service was unsuccessful

Seeking assistance. I am new to Angular + RxJS, so please bear with me if this task seems easy. The concept is to submit a form that includes multiple input fields, one of which is for uploading an image. When the user clicks the submit button, the first ...

angular nganimate animation not displaying div

I've been working on getting my div2 to display like the SlideUp-Click to Toggle button shown here. However, when I check out my code, it seems like it's not functioning as intended. The "open second div" and "hide this div" buttons are supposed ...

Utilizing JavaScript and its scope to include text within an HTML document

I am currently working on a program that receives input from the user twice, specifically a risk carrier and a sum (although it is just a placeholder for now), groups these two values together, and then repeats the contents in a loop. You can see the progr ...

Retrieve a specific key from SQL records

I have recently started learning JavaScript and MySQL. When I run a MySQL query in my server-side JavaScript code, the returned rows are in the following format: For example, if I use console.log(rows), it will display: [ RowDataPacket { id: 7080, ...

What is the best way to implement a never-ending scrolling grid loader within a scrollable area using Codeigniter?

In my Codeigniter framework and bootstrap installation, I have multiple sub-pages. On one of these pages, I am attempting to implement an infinite scroll loader using a jQuery script from a tutorial found at gridScrollFx.js. Here is the JS file I am using: ...

Interacting with individual divisions on a leaflet map

I've been facing a challenge with this interaction for some time now, and finding the appropriate solution seems quite daunting at the moment. Recently, I created a map with basic points using GeoJSON format (generated with PHP & MySQL). I'm cur ...

Exploring a JSON Object with Nested Data

I am trying to recursively parse a JSON object in JavaScript. Below is an example of the JSON structure: const obj = { tag: 'AA', type: 'constructed', value: 'ABCD1', child: [ { tag: 'BB', ty ...