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

前端 未结 2 1517
太阳男子
太阳男子 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条回答
  •  旧时难觅i
    2021-02-05 16:18

    try using:

    element(by.css('[my-unique-id="abc123"]'))
    

    it's easier and more readable than xpath for simple cases.

    more about xpath syntax and when it is usefull: http://www.w3schools.com/xml/xml_xpath.asp

提交回复
热议问题