Seeking the perfect message to display upon clicking an object with Protractor

Currently, I am using Protractor 5.1.1 along with Chromedriver 2.27. My goal is to make the script wait until the message "Scheduling complete" appears after clicking on the schedule button. Despite trying various codes (including the commented out code), I have not been successful in achieving this. Protractor continues execution every time. Any suggestions or solutions?

https://i.stack.imgur.com/8zsFl.pnghttps://i.stack.imgur.com/BCYyr.png

that.serviceFilter.sendKeys(serviceName).then(function() {
  utilsObj.doActionWithWait(that.serviceRowInServiceList, function() {
    utilsObj.doActionWithWait(that.pickFilteredService, function() {
      that.pickFilteredService.click().then(function() {
        that.selectAllBtn.click().then(function() {
          that.actionBtn.click().then(function() {
            that.scheduleBtn.click()

            // //EC = protractor.ExpectedConditions;
            // var aaa = element(by.xpath("//*[@id='SchedulingInProgress']"));
            // browser.wait(function () {
            //   return EC.visibilityOf(aaa).call().then(function (present) {
            //     console.log('\n' + 'looking for element....')
            //     if (present) {
            //       console.log('\n' + 'element not found!')
            //       return true;
            //     } else {
            //       console.log('\n' + 'element found!!')
            //       return false;
            //     }
            //   });
            // }, 50000);

          });
          browser.wait(function() {
            return browser.driver.isElementPresent(by.xpath("//*[@id='SchedulingInProgress']"))
          })
        });
      });
    });
  });
});

Answer №1

It appears that you are utilizing the isElementPresent() function incorrectly, as indicated by the error message. This is a function of the ElementFinder Object and not the driver.

Incorrect Usage -

browser.driver.isElementPresent()

Correct Usage -

browser.driver.FindElement().isElementPresent()

For more information, please refer to this link. If your intention is to wait for a specific element to appear, then you are on the right track - consider using Expected Conditions within browser.wait. You can implement it like this -

browser.wait(EC.visibilityOf(element), 5000); //wait for an element to become clickable

Refer to this link for further details on its usage

Answer №2

At long last, I have discovered the solution!

var EC = protractor.ExpectedConditions;
var elm = element(by.css("#SchedulingInProgress > div:nth-child(2) > div"));

browser.wait(EC.visibilityOf(elm), 50000);
expect(elm.getText()).toEqual('Scheduled 1 out of 1');

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

Tips for addressing dependency issues in react native applications

Starting a new ReactNative project using "react-native init newProject" is giving me some warnings. How can I resolve these issues? npm WARN deprecated [email protected]: core-js@<2.6.5 is no longer maintained. Please, upgrade to core-js@3 o ...

What is the process of turning an SVG element into a clickable link?

Is there a way to transform each element within an SVG image embedded in an HTML file into an active link? I want to create an SVG image with clickable elements. Here is a snippet of the SVG image: <svg version="1.1" id="Layer_1" xmlns="http://www.w3 ...

Prevent a JavaScript file from resetting when a user refreshes the page

I'm currently developing a desktop application using node.js and electron. My task involves creating a JavaScript file that manages multiple processes, stores them in a dictionary, and ensures that the dictionary content is retained even without any r ...

A more efficient method for refreshing Discord Message Embeds using a MessageComponentInteraction collector to streamline updates

Currently, I am working on developing a horse race command for my discord bot using TypeScript. The code is functioning properly; however, there is an issue with updating an embed that displays the race and the participants. To ensure the update works co ...

What is the best way to apply the addClass method to a list element

I've been searching for a solution to this issue for some time now, and while I believed my code was correct, it doesn't appear to be functioning as expected. HTML <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js ...

What's the best way to implement a conditional header in React?

I am looking to create a conditional display of the Header based on different pages. Specifically, I want the Header to be hidden on the Home page and shown on other pages like posts page, projects page, etc. I have been brainstorming possible solutions f ...

Is the mounted hook not being triggered in a Nuxt component when deploying in production (full static mode)?

I have a component that is embedded within a page in my Nuxt project. This particular component contains the following lifecycle hooks: <script> export default { name: 'MyComponent', created() { alert('hello there!') }, ...

Setting the value for a HiddenField using jQuery in an ASP.NET application

Is there a way to set a value for a HiddenField control using jQuery? function DisplayContent(obj) { var FareValue = $(obj).closest('tr').find("[id*=lbFare]").text(); $(obj).parent().parent().find('[id*=pnlGrd]').show(); $ ...

Retrieve the DOM variable before it undergoes changes upon clicking the redirect button

I have been struggling for a long time to figure out how to maintain variables between page refreshes and different pages within a single browser session opened using Selenium in Python. Unfortunately, I have tried storing variables in localStorage, sessio ...

Focus Google Map on Selected Option using AngularJS

I'm attempting to center the map based on a selection in a drop-down select option box. Despite trying various examples, I haven't been successful in getting the map to recenter to the new latitude and longitude coordinates. I'd like to ach ...

Utilize the power of Elasticsearch.js along with Bluebird for enhanced performance

Recently delving into node.js, I've been exploring the powerful capabilities of the bluebird promise framework. One of my current challenges involves integrating it with the elasticsearch javascript driver. After some experimentation, I was able to su ...

Unable to access a function from a different controller within an AngularJS Ionic framework application

How can I trigger or call the callkhs function in the LihatKhsController from the KhsController? function KhsController($scope, $rootScope){ $scope.$emit('callkhs', {param:'test'}); } I am attempting to retrieve parameter values ...

What is the best method to eliminate an invalid element from the DOM?

Below is the code snippet showing the xpaths where the value of $value can be found. We have noticed an abnormal tag td1 in the given URL (visible in the image) which is missing a closing tag. It seems like the developers intentionally placed it there, as ...

Identify all paths with or without the .html suffix, excluding static resources

I am working on configuring a universal handler for requests that do not pertain to images or favicons. I want this handler to manage paths like /index, /index.html, /user/123, and similar, while excluding /favicon.ico, /sunflower.png, /images/starfish.png ...

Having trouble getting a div to slide to the left on hover and collapse on mouseout using Jquery?

Hey there! I need some assistance in completing this code snippet. I have a div with overflow:hidden and a margin-left of 82px. Inside it, there is a share link and a ul list containing three external links. When I hover over the share link, everything w ...

I'm looking to create a unique combination of a line and bar chart. Any advice on how to

When I stretch my Scale like this determineDataLimits: function () { var min = Math.min.apply(null, this.chart.data.datasets[0].data) console.log(this) console.log(defaultConfigObject) Chart.options.scales.rightSide.ticks.min = function ...

Protractor is unable to locate the password input field on Gmail using its ID

Currently, I am in the process of configuring Protractor to test my application. However, I am encountering a roadblock as it requires authentication through Gmail and I am struggling with the login process: describe('Vivace Home page', function ...

What methods are recommended for expanding the size of a select/dropdown menu?

Managing a long list of values can be challenging, especially when it continues to grow. Consider the following example: <select> <option value="1">1, some test</option> <option value="2">2, some text</option> <optio ...

Verifying credentials using Chromium pop-up window with Playwright

In my current project, I am using Playwright to automate the configuration of multiple devices. However, I have encountered a challenge with certain models that require authentication through a popup dialog box in Chrome. https://i.stack.imgur.com/jgnYM.p ...

Converting a JavaScript dictionary into an array of documents: The ultimate guide

I have an object that looks like this: const obj = { "restaurant": 20, "hotel": 40, "travel": 60 } Is there a way to transform it into the format below? const newArray = [ { "category_name": "restaurant", "amount": 20 }, { "category_na ...