Sitemap - 2023 - Selenium For Beginners
Do not use TRY/CATCH in your tests
What to not do when your locators are ..... horrible
Do not use FOR statements in your tests
Do not use IF statements in test methods
Why you should not use null in your code
When using String variables, please avoid the following
What exactly is page object model?
driver.findElements() never fails
Do not save complex values in String variables
If possible, test each functionality only once
Do not use Selenium for visual web testing
Do not use unrelated values in an array
Do not use JAVA doc in your page classes
Break long page classes in many smaller classes
Moving methods from page classes to a base page class does not shorten your code
Your page class will not get smaller if you move the locators outside of it
How to check if lists of elements are sorted
Use Java streams when working with collections
Do not write code that surprises its users
Use soft assertions only for verifying multiple, related fields that are included in the same page
Do not use soft assertions for multiple-page Selenium tests
Reduce the test execution time significantly by setting a page loading strategy
Always search using real, random data
How to make your Selenium tests dynamic with realistic random data
How to make your Selenium tests dynamic
How big should a page method be? How big a Selenium test? How big a page class?
A page class should have few public methods and many private methods
How does a Good Page Class look like?
How does a Bad Page Class look like?
No page objects in the test method
Do not use method parameters for method flow
Do not use a static driver in the test class
Static page methods lead to ugly and confusing test code
How many ways of finding a web element do you know of?
Do not wait for the page to load fully
How should a Selenium test look like?
How to reduce the number of assertions
How to reduce the number of assertions
How to reduce the number of assertions
When custom assertions do not make sense, use verification methods
Always add messages to assertions
Don't mix implicit and explicit waits.
How to create a custom expected condition
Expected conditions cover much more than a web element being displayed or clickable
Do not write your own wait methods
Simplify page object declaration with var
Order methods correctly in a page class
Page methods should return data instead of validating it
What is the best way of selecting an option of a list?
Where can I find a site that uses sliders and jQuery menus?
How should your Selenium tests be?
Switch into frame and out of frame all the time. In the same method
Use enums instead of multiple constants
Keep test scripts focused on doing one thing only
Keep locators in the page object classes
Page Factory does not use any synchronization
No page class fields should be public
Page Factory does not allow dynamic locators
Does Page Factory really lead to shorter page classes?
For simple and fast pages, use Page Factory
Do not use * instead of element's tag in XPATH locators
Have a few public and many private methods in a page class
Do not use assertions in the page classes
A test script should have at least 1 assertion
Have the test scripts working on one layer only
Do not create duplicated locators
Do not reload the current page during the test execution
Make the site navigation explicit
Refactor the page classes often
Write test scripts that express the user intent instead of how the user interacts with the page
Reduce test script size with page objects
Break large test scripts into smaller, independent scripts
Synchronize the test script with the site using explicit waits
Simplify code with static imports
Use StringUtils library for what String class cannot do
Reduce the number of assertions
Use a fresh browser for each test
Do not wrap the whole test script with try/catch
Declare variables where they are used