We can search for specific field on website in a few ways: based on css, name, id, structure, even any text found. Which way have you decided to use?
What would be best practice for it?
Edit: I'm asking from developer perspective: How to write code that it will be easier to test with Selenium by one method (that is: being able to search all of them by it's name)
We generally stay away from xml structure, which turns out to generate way too fragile tests. Our internal organization makes CSS names off-limits, since that is for the design people to manipulate. You don't want your tests to break because someone changes style from heading1 to heading2.
We have opted for a solution that is mainly based on id's. Sometimes we even instrument the HTML with id's just to be able to selenium test.
Additionally we also look for texts (application texts), but internationalization makes this a bit of a pain; we have made our test fixture locale aware.
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