#Selenium
#Testing
What is Selenium?
Selenium is an open-source automated suite of tools that are widely used in Web application automaton testing. It is developed on Java, Ruby, Python languages.
Advantages of Selenium ?
- It is open-source.
- It supports cross-browser testing.
- It support Parallel Test Execution.
- It supports multiple OS (Windows, Mac, Linux/Unix).
- Also support cross-device testing.
- Compatible with C#, Java, JavaScript, Ruby, Python, PHP.
- Support Mouse cursor and keyboard actions.
- Run the test in Local as well as in Servers (Jenkins).
- Large active user community support.
- Easy to Implement.
Disadvantages of Selenium ?
- Didn't support Windows and Mobile applications.
- Didn't support Window based Pop-up.
- Don't have it's reporting tools.
- Can't handle two factor authentication.
- Can't handle dynamic web content.
- Continuous Maintenance of Code required.
- Inability to Test UX.
- Didn't support Bar code reading.
What is Selenium 2.0 ?
Web Testing tools Selenium RC and WebDriver are consolidated in single tool in Selenium 2.0. Basically it represent the merger of WebDriver project and original Selenium project.
What are the Components of Selenium?
There are four components of Selenium:-
- Selenium IDE,
- Selenium RC,
- Selenium WebDriver, It provide the API's for a variety of languages like Java, Python, .NET, PHP, etc.
- Selenium Grid
Selenium IDE: Selenium IDE (Integrated Development Environment) is primarily used to develop test cases. Selenium IDE is an easy to use tool from the Selenium Test Suite. We can automate tests for our web applications easily.
Selenium RC: It is a testing framework that enables a QA or a developer to write test cases in any programming language in order to automate UI tests for web applications against any HTTP website.
Selenium WebDriver: It is a widely used component. It is used to overcome the disadvantages of Selenium RC. Selenium WebDriver does not have a server and it communicates with the browser and runs it. It supports multiple OS platforms and browsers.
Selenium Grid: Selenium Grid is a smart proxy server that makes it easy to run tests in parallel on multiple machines. This is done by routing commands to remote web browser instances, where one server acts as the hub. This hub routes test commands that are in JSON format to multiple registered Grid nodes.
Different types of locators in Selenium.
Different types of locators are
- By.id()
- By.name()
- By.tagName()
- By.className()
- By.linkText()
- By.partialLinkText()
- By.xpath
- By.cssSelector()
There are eight different built-in element location strategies in WebDriver:
- ID
Locates elements whose ID attribute matches the search value.
Method name: By.id(). - Name
Locates elements whose ID attribute matches the search value.
Method name: By.name(). - TagName
Locates elements whose tag name matches the search value.
Method name: By.tagName().
- ClassName
Locates elements whose class name contains the search value (compound class names are not permitted).
Method name: By.className().
- LinkText
Locates anchor elements whose visible text matches the search value.
Method name: By.linkText().
- Partial Link Text
Locates anchor elements whose visible text contains the search value. If multiple elements are matching, only the first one will be selected.
Method name: By.partialLinkText().
- Xpath
Locates elements matching an XPath expression.
Method name: By.xpath().
- CSS Selector
Locates elements matching a CSS selector.
Method name: By.cssSelector().
Note:- One of the most fundamental techniques to learn when using WebDriver is how to find elements on the page. WebDriver offers a number of built-in selector types, amongst them finding an element by its ID attribute is widely used.
Thanks for Reading !!! If you have any Questions Let me know in comment section.