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

Find and conceal the object within the list that includes the term "Ice"

The teacher's assignment is to create a radio button filter that hides items with the word "Ice" in them, such as "Ice Cream" and "Iced Tea." Here is the current code I have been working on: <!DOCTYPE html> <html> <head> <me ...

How to pass a single value using onClick event without relying on form submission

I prefer to pass a single value instead of multiple putPriority fetch calls. This value will not be inputted by the user directly, but rather passed through an onClick event. For example, I want the onClick to send a specific number to "status" in the fe ...

What significance does it hold for Mocha's `before()` if the function passed requires parameters or not?

In one part of my code, I have a describe block with before(a) inside. The function a originally looks like this: function a() { return chai.request(app) ... .then(res => { res.blah.should.blah; return Promise.resolve(); }); ...

Enhanced hierarchical organization of trees

I came across this code snippet: class Category { constructor( readonly _title: string, ) { } get title() { return this._title } } const categories = { get pets() { const pets = new Category('Pets') return { ge ...

Encountering a Selenium webdriver exception specific to Internet Explorer while using Python

My Python code is presented below: from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait print("browser1\n") browser = webdriver.Ie('C:\Program Files (x86)\Internet Explorer\iexplore.exe') pri ...

I'm having trouble getting EJS files to run JavaScript module scripts

I am facing an issue with my ejs file running on localhost. I am trying to execute functions from other files that are imported with js. In the ejs file, there is a module script tag which successfully executes the code of the file specified in the src att ...

Automatically adjusting maps according to internal criteria

I have an example of a map that looks like this const Map = new Map().set('123', [ [ 'foo', 'bar' ] ]).set('456', [ [ 'baz', 'qux' ], [ 'quux', 'corge' ] ]); /* The structure ...

Submitting Files to the API using Vue.js

I have the following code in Vue.js and I am trying to upload a file, but my issue is that I want to save the filename of the uploaded file to the JSON API using a POST method. Is there a way to achieve this? Thank you in advance. <div class="input-f ...

Tips for updating the checkbox state while iterating through the state data

In my component, I have the ability to select multiple checkboxes. When a checkbox is selected, a corresponding chip is generated to visually represent the selection. Each chip has a remove handler that should unselect the checkbox it represents. However, ...

Exploring the capabilities of a Vue.js component

I am currently facing some challenges while trying to test a Vue.js component. My main issue lies in setting a property for the component and verifying that it has been set correctly. For context, the module has been loaded with exports and the JavaScrip ...

Is there a way to hide the <v-otp-input> field in a Vue.js application?

For more information, please visit https://www.npmjs.com/package/@bachdgvn/vue-otp-input <script> export default { name: 'App', methods: { handleOnComplete(value) { console.log('OTP completed: ', value); } ...

The form's validation fails to recognize dynamically added input after the initial validation

I am currently working on a form that dynamically adds inputs. Whenever the user selects a different "supplier" from the addMaterialSupplier dropdown, a new input for the price is automatically added. The issue I'm facing is that when I click the bu ...

The integration of the jQuery library within the server side of a Google Apps Container Bound Script

Can the jQuery library be utilized server-side in a Google Apps Script that is Container Bound to a Doc or Sheet? If so, what steps should be taken? In a previous inquiry on Stack Overflow, I sought guidance on incorporating jQuery into a container-bound ...

obtain delicious cookies delivered straight to your door from an online

Listed below are different methods for retrieving cookies from a website apart from the ones mentioned: Examining the browser settings Utilizing Selenium web drivers with the driver.get_cookies() function ...

What sets apart the JavaScript console from simply right-clicking the browser and opting for the inspect option?

As I work on developing an angular application, one of my tasks involves viewing the scope in the console. To do this, I usually enter the code angular.element($0).scope(). This method works perfectly fine when I access the console by right-clicking on th ...

Avoiding memory leaks in Node.js with Express framework

Dealing with memory leaks in nodejs (express.js) has been a challenge for me. I followed various tutorials online, but unlike the examples provided, identifying the source of the leak in my code has not been straightforward. Through the use of Chrome Dev T ...

Add HTML content individually to each item in the array

I am currently developing a plugin and I need to load a preset in order to populate a form with the relevant data. In an attempt to write concise code, I created a variable called "template" that looks like this: var Fields = '<div c ...

Confirming an error notification with selenium web driver

Can someone help me verify the error message that is displayed when a login attempt fails? I specifically need to check for the text "Invalid username or password". Here is the HTML code snippet: <div id="statusMsg"> <div class=" ...

Display a hyperlink in an iframe on the main page from a different domain using JavaScript

I'm currently using Angular with Wirecard as my payment provider. When I need to add a payment, I open an iframe that directs the user to the Wirecard site to accept the payment. Once the user clicks accept, I provide a link back to my site from Wirec ...

Ways to incorporate vector .svg images into a D3js tree diagram

var treeData = [ { "name": "Top Level", "parent": "null", "remark":"yes", "children": [ { "name": "Level 2: A", "parent": "Top Level", "remark":"yes", "children": [ { "name": "So ...