Currently in my test case I need to write tests to be able to find elements of the customized variety made using web components, example of the html code is below:
<html>
<head>...</head>
<body class>
<customtag1 id="app">
<customtag2 id="app2">
<div id="divid">
<customtag3 class="current icon">
"Text here"
</customtag3>
</div>
</customtag2>
</customtag1>
Now for my selenium test, I have written as follows, written using mocha:
test.it('test', function() {
return driver.findElement(webdriver.By.css("customtag1")).then(function(cus1){
cus1.findElement(webdriver.By.css("customtag2")).then(function(cus2){
cus2.findElement(webdriver.By.css("#divid")).then(function(div){
div.findElement(webdriver.By.css("customtag3 ")).getText();
})
})
})
})
However it seems to have trouble finding any element but the first tag, after the first tag returns the promise object, it can not find the web element customtag2, or any remaining elements. Is there another way of doing it? Or what am I doing wrong here?