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.
尝试使用在DOM
更改后仍然适用的相对XPath
:
//div[text()="Sign in"]
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.