123ArticleOnline Logo
Welcome to 123ArticleOnline.com!
ALL >> Computer-Programming >> View Article

Step By Step Instructions To Make Selenium Webdriver Scripts Faster

By Author: Siyaram Ray
Total Articles: 356

The things that can enhance the Selenium WebDriver contents' speed are as follows:
Utilize FAST SELECTORS:-
Selenium WebDriver contents permit utilizing many sorts of locators. While choosing the locator, begin with the quick ones:
1. look by ID
This works if the html component has the id property. It is the quickest locator as it utilizes the document.getElementById() javascript order which is streamlined for all programs.
2. NAME selector
This works if the component has a name property.
3. CSS selector
It is quicker than XPATH however not as adaptable.
4. XPATH selector
This is the most adaptable methodology for building locators. In any case, xpath selectors are the slowest of all as the program dom of the site page should be crossed for finding the component.
Utilize FEW LOCATORS IN SCRIPTS:-
Keep the quantity of locators as low as conceivable particularly if utilizing XPATH. This runs together with keeping contents engaged and short.
Make ATOMIC TESTS:-
Abstain from testing excessively numerous things in a solitary content. It is smarter to have all the more little contents concentrated on one thing just than less huge contents that do an excessive number of things.
• Each test should test a solitary minor piece of usefulness
• Each test ought to have up to 20 stages.
• Each test should keep running in less than 10 seconds.
Having nuclear test is extremely valuable if there should arise an occurrence of disappointments. The disappointments are clear about where the issue is.
Illustration:-
Let’s expect that one of the contents is called testSignupLoginChangePasswordLogout().
This content checks 4 distinct things:
• Information exchange frame works
• Login works
• Change secret word works
• Logout works
In the event that the content falls flat, which part has a mistake? Information exchange? Login? ChangePassword? Logout?
Rather, we should utilize littler and nuclear contents: testSignup(), testLogin(), testChangePassword(), testLogout().
In the event that any of the littler tests falls flat, it is clear where the issue is.
DONT TEST THE SAME FUNCTIONALITY TWICE:-
Ensure that your contents are not looking at similar highlights and over. In the event that you watched that the login works effectively in one content, there is no advantage from checking it again in content.
Compose GOOD TESTS:-
Great tests are made by following a couple of basic principles:
• Great composed tests are quick tests.
• Dispose of step duplication
• Keep the contents free
• Compose simply enough strides to go from A to B in the snappiest way that could be available
• Evacuate steps that are not identified with the last outcome
Utilize ONLY EXPLICIT WAITS:-
A standout amongst other methods for making content quicker is by utilizing just unequivocal holds up. The content execution is better with express holds up as HTML components are gotten to when they end up noticeably accessible. No extra holding up times are required.
Utilize THE CHROME DRIVER AND CHROME BROWSER:-
On the off chance that you require a genuine program, utilize Chrome and the Chrome driver. The Chrome program is quicker than IE, Firefox, Safari and Opera. The same is substantial for the Chrome web driver.
Utilize HEADLESS BROWSERS AND DRIVERS:-
On the off chance that you don’t require a genuine program or you utilize constant combination, headless programs and drivers can make your contents quicker. A headless program is a program that does not have a UI.
The most mainstream headless programs are HTML UNIT and Phantom JS:
HTML UNIT
• headless program written in Java
• uses the RHINO motor; this isn't extraordinary as this motor isn't utilized by any of the current genuine programs
• provides javascript and ajax support and fractional rendering ability
Ghost JS
• headless program that uses the WEBKIT format motor for rendering site pages and Javascript Core for executing scripted tests
• the WEBKIT motor is utilized by genuine programs, for example, CHROME and SAFARI
• uses Ghost Driver as an execution of the WebDriver Wire Protocol
REUSE THE BROWSER INSTANCE:-
A run of the mill JUNIT class incorporates the accompanying parts:
• constructor
• setUp() strategy
• tearDown() strategy
• test contents
The setUp() strategy utilizes the @Before comment and keeps running before each test content. Its motivation is more often than not to make the driver protest and open the program window. The tearDown() strategy utilizes the @After explanation and pursues each test content. Its motivation is to annihilate the driver protest and close the program window.
Each test content is utilizing its own particular program case when the @Before and @After are utilized:
Try not to LOAD ANY IMAGES IN THE WEBPAGE:-
Many site pages are exceptionally rich in pictures so they don't stack quickly in the program. In the event that the page stacks quicker in the program, the content will be speedier too. The page will stack speedier if no pictures are stacked. This can be expert by setting up another profile for the program and impair stacking pictures for it.
About Author:
Selenium training in Bangalore is available at Infocampus. Infocampus is an institute which can be a great step for freshers to get the job in IT. It offers 100% placement assistance for candidates. Selenium training will be provided by a professional expert and classes are focused on practicals. Enquire at http://infocampus.co.in/best-selenium-testing-training-center-in-bangalore.html to get more details on selenium courses in Bangalore or contact 9738001024.

More About the Author

best institute for selenium training in Bangalore – Infocampus. Infocampus is an excellence training center for selenium courses in Bangalore. At Infocampus, selenium training is focused on practical and real time examples. Contact Infocampus at 8884166608 or visit http://infocampus.co.in/best-selenium-testing-training-center-in-bangalore.html for complete details on selenium training.

Total Views: 58Word Count: 859See All articles From Author

Computer Programming Articles

1. Test Automation – Importance Of Selenium Ide With Features
Author: Siyaram ray

2. The Effect Of Chicken Cage On Temperature Regulation Of Chicken House
Author: The effect of chicken cage on temperature regulati

3. The Chicken House Needs Ventilation
Author: The chicken house needs ventilation

4. Automation Testing - Instructions For Integrating Jenkins With Selenium Webdriver
Author: Siyaram ray

5. 10 Performance Enhancement Tips For Mobile App Development
Author: august sin

6. E-commerce Software Provider Company In India For Best E-commerce Solutions
Author: Zentryx Tech

7. Automation Testing - Selenium Webdriver Testing Tool
Author: Siyaram ray

8. Career Opportunities As A Selenium Tester
Author: Siyaram ray

9. How To Do A Good Job In Heatstroke Prevention In Chicken Farms
Author: How to do a good job in heatstroke prevention in c

10. Selenium Testing Tool Is More Used In Automation Testing
Author: Siyaram ray

11. Simplify For Better Sales: Tips For Optimizing The Checkout Page
Author: Shailesh Gajjar

12. Did Web Development Training Is Require
Author: Siyaram ray

13. Join Selenium Training In Bangalore To Become Selenium Master
Author: Siyaram ray

14. Direct Mail Marketing Services – Why It Is An Integral Part Of Your Advertising Campaign
Author: Daniel Mena

15. Building Advance Website On Drupal Cms – A Scalable Option For Your Business
Author: Zentryx Tech

Login To Account
Login Email:
Password:
Forgot Password?
New User?
Sign Up Newsletter
Email Address: