Delving into the world of CSS as a newcomer, I aim to steer clear of using xpath in my Protractor AngularJS test automations. Despite successfully targeting a specific element within a list, Protractor warns me about multiple elements found for the locator. To avoid such issues in the future, especially when not always needing the first list item, I seek clarity on leveraging CSS to reach my destination - a task made challenging by vague documentation. My current focus is on capturing the "Marketing Venue" element but will eventually expand to include other elements below it. The snippet showcases how AngularJS currently aids in retrieving text data. Much appreciated for any insights.
var iPlanLevel=element(by.css("div:nth-of-type(2) > div:nth-of-type(2) > div > div:nth-of-type(1) > span")).getText().then(function (text) {
console.log(text);
}
);
<!-- begin snippet: js hide: false -->
<div class="home-info">
<span class="web-developer-id-class-details"></span>
<div class="home-top home-section"></div>
<span class="web-developer-id-class-details"></span>
<div class="home-bottom home-section">
<h3></h3>
<span class="web-developer-id-class-details"></span>
<div class="home-box">
<span class="web-developer-id-class-details"></span>
<span class="home-name"></span>
<br></br>
Lindemannstrasse 88
<br></br>
Dortmund 44137
<br></br>
<br></br>
<span class="web-developer-id-class-details"></span>
<div class="property-group meduim">
<div></div>
<span>
MarketingVenue
</span>
</div>
<span class="web-developer-id-class-details">
.property-group.meduim
</span>
<div class="property-group meduim">
<div></div>
<span>
December 31, 2016
</span>
</div>
<span class="web-developer-id-class-details"></span>
<div class="property-group meduim"></div>
<div></div>
<br></br>
</div>
<span class="web-developer-id-class-details"></span>
<div class="home-box"></div>
</div>
</div>