问题
Recently I was using protractor to automate the Application developed using HTML 5 , angular 2 , java-script. I was able to automate it without any issues. But recently developers have changed the controls to DevExtreme HTML JS. After that the tags are changed (For example dx-text box
, dx-tool-tip
which are non HTML). So I am not able to automate now using protractor. I have tried all the possible combinations but it is not working.
So can anyone please help me out, whether protractor supports DevExtreme controls or is there is any alternative for that?
Below is the HTML for the new code :-
HTML code
Previously I was locating it with the id = inputUserName
it was working fine but now it is throwing error. I have tried all the possible ways to locate it but no luck.
Can anyone please let me know whether anyone has used protractor before to automate the application that is using DevExtreme HTML JS controls ?
回答1:
Technically it is still HTML. Your issue is the id you were using is no longer attached to the input element. You can now use element(by.css('#inputUserName input.dx-texteditor-input'));
The xpath solution in the comment might work but if the password field also has the same class you will have multiple elements including the id from the parent element gives you some security.
来源:https://stackoverflow.com/questions/42693503/protractor-how-to-locate-element-by-custom-non-html-tags