Categories
Uncategorized

Selenium WebDriver Tips for Beginners

We are helping our community to learn selenium, in this endeavour we are sharing some root tips. Please feel free to add more to the list from your experience.

It is rightly said, “All the so-called ‘secrets of success’ will not work unless you do.” So build your learning and share more.

Berry Hard Work
Go step by step to learn selenium, it requires co-ordinated self effort to finish the task.

1. Always try to locators in the preference order, id > css > name > xpath

2. Say no to Thread.sleep (), implement the implicit or explicit wait methodologies in selenium or try to write your own conditional logic to handle the elements, rather than using Thread. Sleep.

3. Using switch case, to implement various drivers of multiple browsers

4. Clean the things, after the execution is completed. It can be achieved by using– Close (), Quit (), and Dispose ().

5. Assert vs verify, be clear what we need to use.
If we use an assert, the test will stop at that point and not run any subsequent checks. In contrast, verify commands will not terminate the test. It will run to completion whether the checks find defects or not. Thus check your requirement and choose the one which is more suitable.Generally Assert is more commonly used than verify due to their immediate feedback.

6. Disable updates, once we have the right version of browser (say Firefox) and WebDriver jars, make sure that you disable the automatic update of browser.

7. Utilize the inbuilt tools of Firefox like firebug/firepath to assist in object identification.

8. Never be too much dependent on “selenium-IDE”;don’t invest much of your learning effort on IDE. It is just a start; focus in the basic functionality of IDE and move on to build incremental and iterative automation suite using Selenium WebDriver.

9. Brush up, basic Java skills or any oops language, to make things easier while moving to real coding.

10. Never give up, take things slowly and build it step by step. Remember you need to sweat hard to achieve mastery in selenium but it is not insurmountable. 

@PhotoCredit

2 replies on “Selenium WebDriver Tips for Beginners”

Here I wanted to add some points,
How to define Test Suit Architecture,
How to decide which testing approach for the application under test.
Which things to automate and which not.
When to start the automation for the application.
How to generate effective report.
What about BDD with Cucumber+Selenium+java.

Leave a Reply to Anonymous Cancel reply

Your email address will not be published. Required fields are marked *