All FREE courses - https://automationstepbystep.com/
00:00 Introduction
00:55 How to find an element
08:16 How to find elements
12:54 How to find an element from element
17:01 How to get active element
19:20 How to get element tagname, text, css value
22:51 How to check is element enabled, selected
Web Element Locator Strategies/functions
How to find element:
findElement()
driver.findElement(By.name("q"));
How to find elements:
findElements()
driver.get("https://trytestingthis.netlify.app/")
// Get all the elements available with tag name 'select'
List<WebElement> elements = driver.findElements(By.tagName("select"));
for (WebElement element : elements) {
System.out.println("Paragraph text:" + element.getText());
}
How to get element from element:
driver.get("http://www.google.com");
WebElement searchForm = driver.findElement(By.tagName("form"));
WebElement searchBox = searchForm.findElement(By.name("q"));
searchBox.sendKeys("selenium");
How to get active element:
activeElement()
driver.get("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webElement");
// Get attribute of current active element
String attr = driver.switchTo().activeElement().getAttribute("title");
System.out.println(attr);
How to get element tagname, text, css:
getTagName()
getText()
getCssValue()
driver.get("http://www.google.com");
//returns TagName of the element
String value = driver.findElement(By.cssSelector("h1")).getTagName();
How to check element is Enabled | is Selected:
isEnabled()
isSelected()
driver.findElement(By.name("---")).isEnabled();
driver.findElement(By.xpath("---")).isSelected();
#Selenium4Tutorials
Stories by Raghav - https://automationstepbystep.com/stor...
My Udemy Courses - https://automationstepbystep.com/udem...
Every LIKE & SUBSCRIPTION gives me great motivation to keep working for you
You can support my mission for education by sharing this knowledge and helping as many people as you can
If my work has helped you, consider helping any animal near you, in any way you can.
_______ ONLINE COURSES TO LEARN _______
https://automationstepbystep.com/free...
GitHub - https://github.com/Raghav-Pal/
Udemy - https://www.udemy.com/user/raghav-pal-3/
Training by Raghav at your venue - [email protected]
Training schedule - https://automationstepbystep.com/trai...
----------- UI TESTING -----------
Selenium Beginners - https://bit.ly/2MGRS8K
Selenium Java Framework from Scratch - https://bit.ly/2N9xvR6
Selenium Python - https://bit.ly/2oyMp5x
Selenium Tips - https://bit.ly/2owxc50
Selenium Builder - https://bit.ly/2MKNtlq
Katalon Studio - https://bit.ly/2wARFdi
Robot Framework with RIDE- https://bit.ly/2Px6Ue9
Robot Framework with Eclipse - http://bit.ly/2N8DZxb
Protractor - http://bit.ly/2KtqVkU
TestProject - http://bit.ly/2DRNJYE
----------- API TESTING -----------
Web Services (API) - https://bit.ly/2MGafL7
SoapUI - https://bit.ly/2MGahmd
Postman - https://bit.ly/2wz8LrW
General - https://bit.ly/2PYdwmV
Katalon Studio API Testing - https://bit.ly/2BwuCTN
----------- MOBILE TESTING -----------
Appium - https://bit.ly/2ZHFSGX
Mobile Playlist - https://bit.ly/2PxpeUv
----------- CI | CD | DEVOPS -----------
Jenkins Beginner - https://bit.ly/2MIn8EC
Jenkins Tips & Trick - https://bit.ly/2LRt6xC
Docker - https://bit.ly/2MInnzx
Kubernetes - http://bit.ly/2MJIlMK
------------VIRTUALISATION------------
Virtualization on windows - http://bit.ly/2SItIL9
----------- VERSION CONTROL SYSTEM -----------
Git & GitHub - https://bit.ly/2Q1pagY
GitLab - http://bit.ly/2kQPGyQ
----------- PERFORMANCE TESTING -----------
JMeter Beginner - https://bit.ly/2oBbtIU
JMeter Intermediate - https://bit.ly/2oziNVB
JMeter Advanced - https://bit.ly/2Q22Y6a
JMeter Tips & Tricks - https://bit.ly/2NOfWD2
Performance Testing - https://bit.ly/2wEXbLS
----------- PROGRAMMING -----------
Java Beginners - https://bit.ly/2PVUcXs
Java Tips & Tricks - https://bit.ly/2CdcDnJ
GROOVY - https://bit.ly/2FvWV5C
JAVASCRIPT - http://bit.ly/2KJDZ8o
PYTHON - http://bit.ly/2Z4iRye
----------- IDE -----------
Visual Studio Code - https://bit.ly/2V15yvt
----------- BUILD TOOLS -----------
Maven - https://bit.ly/2NJdDRS
Gradle - http://bit.ly/30l3h1B
----------- OTHERS -----------
Redis- https://bit.ly/2N9jyCG
Misc - https://bit.ly/2Q2q5xQ
Tools & Tips - https://bit.ly/2oBfwoR
QnA Friday- https://bit.ly/2NgwGpw
Sunday Special - https://bit.ly/2wB23BO
Ask Raghav - https://bit.ly/2CoJGWf
Interviews - https://bit.ly/2NIPPxk
All Playlists - https://bit.ly/2LSiezA
---------- Connect with Raghav -----------
Website - https://automationstepbystep.com/
LifeCharger -
Udemy Courses - https://www.udemy.com/user/raghav-pal-3/
Facebook - / automationstepbystep
Twitter - / learnwithraghav
Youtube - / automationstepbystep
Never Stop Learning
Raghav