Selenium ? Features, Xpath Patterns and User Extensions

Posted by Infocampus HR on January 3rd, 2018

What is Selenium Test?

Selenium is an open source web test computerization device utilized for mechanizing electronic application tests. It has a few parts:

  • Selenium IDE(a Firefox module utilized for recording and playing back test application)
  • Selenium RC (Selenium Server to dispatch and communicate with web programs)
  • Selenium Client Driver (Selenium API, which can be utilized with numerous dialects)
  • Selenium Grid (Selenium Hub to dispatch various tests in the meantime)
  • Selenium WebDriverBackedSelenium (used to run Selenium RC applications with Selenium Web Driver

Selenium Features:

  • Works anyplace Javascript is upheld
  • Hooks with numerous different dialects: Java, .Net, Ruby, Python
  • Can mimic a client route through pages and web components
  • Verifies and attests data on the website page
  • Actual content is HTML based, so natural to learn and utilize it immediately
  • Can make a test suite that incorporates different experiments
  • Can run the test suite with Selenium IDE or Selenium summon line
  • Selenium API can bolster different programs, so application program similarity can be tried effectively.
  • Selenium IDE contains rich charges to utilize when recording and playing back test applications.
  • Selenium cell phone programming interface can test portable application.

What amount does Selenium permit cost per customer machine?

Selenium is open source programming, discharged under the Apache 2.0 permit and can be downloaded and utilized without charge.

Selenium IDE Useful Xpath Patterns:-

When utilizing Xpath in Selenium IDE or Selenium WebDriver to distinguish web components, here are some helpful examples to find dynamic esteems for component's id qualities.

  • text

/div[text()='selenium master']

  • starts-with

where 12345 is a dynamic number you could utilize the accompanying XPath:

/input[starts-with(@id, 'username-')]

  • contains

/span[contains(@class,'login')]

For the above xpath, utilizing Css is speedier and neater. css=span.login.module

Utilizing Xpath Checker in Selenium Test Automation:-

When utilizing Xpath, affirming the Xpath content is essential to ensure that Selenium IDE, WebDriver or Selenium RC can distinguish the xpath locator amid the test.

QA Engineers can utilize Xpath Checker to confim xpath. Xpath Checker should be introduced on Firefox in light of the fact that it is an extra.

For instance, on Wikipedia page, there is a connection named "English". When utilizing xpath, we can utilize the content beneath.

xpath=//div/a[text()="English"]

While affirming the xpath with Xpath Checker, Xpath Checker shows the connection.

Selenium IDE Xpath Tutorials:-

QA Engineers need to give any component locator(like id, name, css way, xpath and so forth.) in target section of selenium window to find that particular component to play out some activity on it .If you have worked with selenium IDE then you realizes that occasionally components does not contains id or name. Finding component by xpath is the method for finding component and you can utilize it as an option of id or name of component.

Path in XML report demonstrates the heading of component area through hubs and traits.

There are three fields 1. Info content box 2. select drop down and 3. input catch. What's more, roar of those fields there is development of relative XML hubs through firebug. As you find in picture, you can utilize "id=searchInput" or "name=search" to recognize input content box to type something in to it.

Selenium IDE User Extensions:-

Client augmentations are JavaScript records that enable one to make his or her own customizations and highlights to include extra usefulness. Frequently this is as redone charges despite the fact that this extensibility isn't restricted to extra orders.

To include client augmentations, open the "Alternatives" menu and select choices. On the Selenium IDE Options window, include Selenium IDE expansions.

Utilizing Globbing Pattern and Regular Expression with Selenium IDE:-

In some experiments, QA Engineers need to confirm content or number examples by utilizing verifyTextPresent, verifyTitle, verifyAlert, assertConfirmation, verifyText, and verifyPrompt. Selenium locators can use example to depict exceptional characters, and dynamic writings to check what content is relied upon as opposed to specifying that content precisely.

There are three kinds of examples: globbing, normal articulations, and correct.

  • which means "coordinate anything," i.e., nothing, a solitary character, or many characters.
  • [ ] which means "coordinate any single character found inside the square sections.
  • [aeiou] coordinates any lowercase vowel
  • [0-9] coordinates any digit
  • [a-zA-Z0-9] coordinates any alphanumeric character

When utilizing globbing design, for a Selenese charge, you can prefix the example with a glob: name

Standard Expression Patterns:

Standard articulation designs are the most intense of the three sorts of examples that Selenium underpins. General articulations are likewise upheld by most abnormal state programming dialects, numerous word processors, and a large group of instruments, In Selenium, normal articulation designs enable a client to perform many undertakings that would be extremely troublesome something else. For instance, assume your test expected to guarantee that a specific table cell contained only a number. regexp: [0-9]+ is a straightforward example that will coordinate a decimal number of any length.

Correct Pattern:

Correct example implies that clients need to confirm the correct messages or numbers. It utilizes no extraordinary characters by any means.

About Author:

Infocampus is an institute that provides selenium training in Bangalore. Infocampus conducts practical oriented classes with real time projects with live examples. Selenium classes will be taken by an expert professional having 10+yrs of work experience. Attend free demo classes before joining selenium course. Infocampus is a best selenium training institute in Bangalore. Call 9738001024 and get more details.

Like it? Share it!


Infocampus HR

About the Author

Infocampus HR
Joined: December 10th, 2016
Articles Posted: 792

More by this author