Our team is working on a web app with AngularJS. For testing, we use Jasmine for unit testing and angular-e2e testing. That works fine. However, our QA team approached us today that they tried to use selenium for testing the web app but facing problems as we are not defining IDs for most DOM elements. We have researched a bit on this but no luck. May someone suggest a good way to do selenium test without having us to explicitly add in all the ids just for the use of selenium? Thanks!
Update
We have some meetings and ended up inserting ids to elements for robustness in testing. Thanks everyone for answering :)
Selenium API has implementations in several major programming languages - allowing you to write your tests in Java, C#, python, ruby, JavaScript and more. If you already have a selenium-based e2e testing framework in place - you can use it also for AngularJS web-apps.
To use ngWebDriver in selenium all you need to do is just add the maven dependency from mvnrepository (https://mvnrepository.com/artifact/com.paulhammant/ngwebdriver) to your pom. xml file as shown below.
Selenium is an open-source automation testing tool that supports a number of scripting languages like C#, Java, Perl, Ruby, JavaScript, etc. Depending on the application to be tested, one can choose the script accordingly.
If you are using Selenium WebDriver there are many ways to find elements on a page. XPATH is probably one of the better approaches as far as flexibility goes (though it can get ugly quickly) but WebDriver also allows you to use Class Names, Tag Names, Name, Link Text and CSS.
Selenium WebDriver - Locate UI Elements
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With