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: 303

The things that can enhance the Selenium WebDriver contents' speed are as follows:
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.
Keep the quantity of locators as low as conceivable particularly if utilizing XPATH. This runs together with keeping contents engaged and short.
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.
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.
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
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.
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.
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:
• 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
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:
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.

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

Computer Programming Articles

1. Top 6 Dating Apps Solo Travellers Should Download
Author: Pulkit Goel

2. Finish Setup Of Selenium Grid 2.0 With Hub And Node Setup
Author: Siyaram Ray

3. What If Selenium's Highlight Command Was Always On?
Author: Siyaram Ray

4. Ways To Hire A Skilled Web Developer
Author: CMTech

5. Enterprise Quality Strategy - Where Does Selenium Fit In It?
Author: Siyaram Ray

6. Requirements Gathering Form Overview For Web Development
Author: Siyaram Ray

7. For What Reason Is Website Development So Important?
Author: Siyaram Ray

8. Profession Scope In Selenium - The Future Of Testing (part 2)
Author: Siyaram Ray

9. Profession Scope In Selenium - The Future Of Testing
Author: Siyaram Ray

10. Design And Usage Of Selenium Web Driver In Automation Testing
Author: Siyaram Ray

11. Career Trends In Web Development
Author: Siyaram Ray

12. Selenium Tool Utilization In Automation Testing
Author: Siyaram Ray

13. Digital Marketing Is Catalyst For Your Business
Author: brain waves

14. Overview Of Web Development And Ventures To Becoming A Web Developer
Author: Siyaram Ray

15. Web Development Future By These Trends
Author: Siyaram Ray

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