Techlisti 1
Techlisti 1
Selenium | Java | Rest API | Postman | JMeter | Automation Tutorials & Tools | Top
Selenium Blogs | Software Testing | Python | Hacking | Guest Blogs | Webinars | Coding
Interview Q&A
HOME
SELENIUM
JAVA
DEMO SITES
ASSIGNMENTS
INTERVIEWS
REST API
TESTNG
CONTACT
JMETER
GUEST POSTS
SOFTWARE TESTING
TOP 10
BLOG
MORE…
HACKING
// Find Element
driver.findElement(arg0);
Selenium Locators
Locators are used to tell Selenium that on which GUI element (text box, radio
boxes, links, buttons etc.) action has to be performed. We must have basic
knowledge of HTML in order to learn locator techniques. There are total of 8
locators by which we can find element in Selenium Webdriver. Here is the list:
1. ID
2. Class Name
3. Name
4. Link Text
5. Partial Link Text
6. Tag Name
7. Xpath
8. Css Selector
HTML Code for Sample Login Page with Id, Name and ClassName attributes:
Example:
If html tag has more than one attribute, we can pick one whose value is unique in the whole
html code.
If Html tag don't have any of the three attribute in that case we have to use xpath or css
selector.
If we have duplicate ids say more than one tag/element has same id, then also we have to use
xpath or css selector.
Example:
1. Open https://www.techlistic.com/
2. I want to click on any menu link let's say on
'Selenium Tutorial' link using Selenium.
3. You have to write text of the link (which is
displaying on the page) in the Selenium
command.
Using this command one locate elements using html tag name.
Code Example:
Comments
Popular Posts
Top 10 Demo Websites to Practice Selenium Webdriver Online
- February 27, 2020
In this post you will find links of top demo websites/pages which Automation
Professionals can use for practice purpose. Here is the list of demo websites:
1. AUTOMATION PRACTICE FORM Level - BeginnerAbout - This form contains all the
important form elements which we come across daily like text box, radio button, check
box, select drop downs, multi-select box, button, links, File Upload, Download link.
Sometimes we don't want to take screenshot of the full screen. Reasons might be, full
size images would last in huge memory storage for image directory or…
READ MORE
Automation Framework Building 1st step - Implementing Code Re-
usablility
- July 23, 2019
In this post, you will learn kind of coding pattern which is very helpful in maintaining our
automation code. This post is written insight to help beginners. We'll learn that instead of
writing a linear script, we should create page (action) methods which in general contain
actions which we are going to perform on our web software.
Let's say, we have a login functionality in our software and we have to automate it. In
that case we'll create a method named login and write the commands like, entering
username, password and click login in that method. Now we can use that method
wherever we need it in other test cases as well. Benefits of using action methods are:
You can also place these action methods in some other class like Common.java. And if
you want to re-use any of the methods in your Selenium script, just create the object
Comm…
READ MORE
Selenium WebDriver - Browser and Navigation Commands
- January 20, 2020
Browser commands are the starting point of your Selenium Webdriver script. These
commands used to launch browser, maximize it, open URL to be tested and other
navigation commands.
1. Browser Commands i. Set Path of browser/driver executable:
This would be the first line of your webdriver script. You have to download the browser
executable file for the browser you are using and set path of the driver executbale to
system property.Like for firefox you have to download geckodriver.exe and place in your
project. Similarly for other browsers you have to download their browser/driver
executables.Download Driver Executables link
- https://www.seleniumhq.org/download/Below is an example for Firefox.
Powered by Blogger
Theme images by mammuth
Followers
Selenium Links
Selenium Tutorials
TestNG Integration
Blogs/Articles
Practice Assignments
Demo Websites
Interview Q/A
Online Training
Website Links
Tech Trends
Java Blogs
Python
Hacking
Selenium IDE
Guest Posts
Tutorials List
Software Testing
Java Tutorial
Selenium Tutorial
TestNG Tutorial
Labels