I'm running e2e tests with Protractor and Selenium on a Polymer/Angular App. Most of the elements are in the shadow DOM (I managed to handle it with custom css locators but it made my tests unstable as any change in the dom breaks them). The problem is that the devs have implemented a virtual scroll list : Only a few items are loaded in the scroll list, next ones are loaded when you scroll. I asked my devs how to deal with it and they told me I had to get the web-component and test it without protractor aka running commands like this :
document.querySelector('virtual-scroll').baseList
Where baseList is a public property of the tag. I tried
var element = browser.executeScript('return document.querySelector("virtual-scroll")');
element.then(function (el){
console.log(el.$.baseList);
});
but the command above returns a WebElement. Is there any way to return the HTML DOM element as a javascript querySelector command does ?
EDIT : as requested the source code with the property of the scrollList that I want to get
by.deepCSS()
which used to find an element by css selector within the Shadow DOM, for detail: protractortest.org/#/api?view=ProtractorBy.prototype.deepCss – yong