Reputation: 670
I'm currently working on creating a test which will be able to click a link which is in a div. The problem is my developer has changed some part of the UI and as a result my XPath locator is not working. Also using Xpath is not feasible as in future some UI might change and I wont be able to locate the element.
My div tag looks like this and I want to perform a click on the div tag.
<div class="link verticalCenter" ng-click="replaceLocation('login')">Sign in</div>
PS: I can't use css locator for it.
Please let me know how can I achieve this.
Upvotes: 0
Views: 373
Reputation: 3091
You still might use CSS, but with some special locator:
element(by.cssContainingText('div', 'Sign in'))
http://www.protractortest.org/#/api?view=ProtractorBy.prototype.cssContainingText
Upvotes: 1
Reputation: 52695
Try to use relative XPath
that will be still applicable after changes in DOM
:
//div[text()="Sign in"]
Upvotes: 2