Giter Site home page Giter Site logo

Comments (8)

juliemr avatar juliemr commented on May 5, 2024 5

Hi,

like all webdriver functions, findElements returns a promise. So, to get the length, you'll need to do

ptor.findElements(protractor.By.css('selector-string')).then(function(elems) {
  var length = elems.length; // Here's your length!
});

from protractor.

juliemr avatar juliemr commented on May 5, 2024 2

The .length bit is incorrect, not sure where that came from. element.all(...).count() should do the trick.

from protractor.

stickel avatar stickel commented on May 5, 2024

Fantastic! Thank you so much. 😄

from protractor.

jarl-dk avatar jarl-dk commented on May 5, 2024

It would be nice however it this would integrate well with jasmin matchers (https://github.com/pivotal/jasmine/wiki/Matchers), such that you could write:

expect(ptor.findElements(protractor.By.css('.selector-string'))).
  toContain(3);

from protractor.

pursual avatar pursual commented on May 5, 2024

So apparently this video is incorrect at 25:40 by indicating you can simply use .length()?
https://www.youtube.com/watch?v=idb6hOxlyb8

Actually there are all kinds of things in that video that dont work? Im confused.

from protractor.

abhisharma2 avatar abhisharma2 commented on May 5, 2024

👍 on the count() - thanks @juliemr

from protractor.

EvanBurbidge avatar EvanBurbidge commented on May 5, 2024

@juliemr in your example above it returns the length, but can you also use this to be able to use the .sendKeys() function to the element? Have an element inside a tab, inside a directive and this is the only piece of code thats sent anything back from it.

from protractor.

stickel avatar stickel commented on May 5, 2024

@EvanBurbidge Yes, you should be able to do a number of things with the element in the example above, including sendKeys().

from protractor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.