Protractor - How to locate element by custom (non HTML) attributes?

前端 未结 2 1540
太阳男子
太阳男子 2021-02-05 15:44

I am using Selenium WebDriver and Protractor to run e2e tests on my angular project. Let\'s say I have an element like:

2条回答
  •  甜味超标
    2021-02-05 16:21

    Try to use xpath:

    element(by.xpath('//div[@my-unique-id="abc123"]'))
    

    or only by attribute

    element(by.xpath('//div[@my-unique-id]'))
    

提交回复
热议问题