PierBJX
PierBJX

Reputation: 2353

Get an element from an ID by.css() in protractor

Using protractor, I would like to get a canvas which is in div. For example like this:

<div id="myId">
 <canvas></canvas>
</div>

Unfortunately, the canvas can not have an id for some reasons. Therefore, I would like to know if it was possible to do something like that with protractor:

let myCanvas = element(by.css('#myId > canvas'));

Upvotes: 1

Views: 81

Answers (1)

Yevhen Laichenkov
Yevhen Laichenkov

Reputation: 8662

Try this:

const myCanvas = $('#myId canvas');

Upvotes: 1

Related Questions