How to select element in Protractor by html attribute when value contains

寵の児 提交于 2019-12-04 10:49:32

Sure, use the "contains" or "ends-with" CSS selector:

element(by.css("input[id*=Solution_MultiComboSelection_Input]"));
element(by.css("input[id$=Solution_MultiComboSelection_Input]"));

If that is the only element with ComboBoxInput_Default as the class, then you could select it using element(by.css('.ComboBoxInput_Default'))

This page has a lot of examples for selectors.

Hard to know for sure without seeing the rest of the page but I'd try...

$('input[value="-select-"].ComboBoxInput_Default);

or maybe

$('div.ComboBoxInput_Default input.ComboBoxInput_Default);

That said, the best solution is to have an identifier added to the code. Hope this helps!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!