The Selenium Locators are commands, that tells IDE which IDE elements it needs to operate on. The identification of the correct GUI element is a prerequisite to creating the automation script. using locators, we can match the element pages and interact with them.
Each element has a unique ID. We can easily find the elements using ID locator. According to W3c, ID’s are unique on the page and makes it more reliable. And this is the fastest and safest elementor.
id= id of the element
It is used to identify the elements on the web page. Moreover, locating elements using Name locator is the same as locating using Name locator. But these are not unique on the page. And if there are multiple elements with the same name locator, then the first element on the page is selected. And the test fails, if another element with the same name locator is present on the web page.
name = name of the element
This gives the element that matches the value specified with the class attribute “class”
This is used to find elements matching with a specific tag name. Moreover, it is helpful when we extract the content within a tag.
findElement(By.tagName(” Tag Name”))
This locator works on hyperlinks. And if there are multiple elements with the same link text then the first one will be selected.
There are some situations, where we need a link to the certain portion of text. In such cases, we use partial link text locators.
This the best way to locate the elements on the web page. Many testers believe, CSS makes the test execution faster. Moreover, testers added, this selector makes the test execution faster. And they added, it is the best way to locate the elements on the page. Selenium supports the following CSS selectors.
Tag and ID :
Tag and Class:
Tag and Attribute:
Tag, Class, and Attribute:
Xpath locator can easily navigate the XML documents. Its purpose is to select individual elements, attributes, and some other parts for XML document for specific processing. Moreover, this XPath produces reliable locators. But when compared to CSS selector, this has slow performance.
Testing a page :
To start testing the webpage , we need to open the webpage ad provide a URL to navigate to the page. Run the folling code in the Eclipse IDE to naviagte to the facebook login page.
public class WebDriverClass
public static void main(String args)
WebDriver driver = new FirefoxDriver();
Also check the importance of Cross Browser testing
to our newsletter
Today application testing is the deciding factor to launch the application into the market. And people do not launch the application unless it goes true.
Today many people were enthusiastic, to know the exact details of things happening around him. This can get the proper knowledge on Blockchain.
Zeal to learn ethical hacking is common among college students and IT professionals. Because everybody wants to secure their system from cyber attacks.
Python is a dynamic interrupted language which is used in wide varieties of applications. It is very interactive object oriented and high-level programming language.
Tableau is a Software company that caters interactive data visualization products that provide Business Intelligence services. The company’s Head Quarters is in Seattle, USA.
Pega Systems Inc. is a Cambridge, Massachusetts based Software Company. It is known for developing software for Customer Relationship Management (CRM) and Business process Management (BPM).