SlideShare une entreprise Scribd logo
1  sur  38
Lockdown Technical Webinars
Weekly Webinars for Undergraduates while in Lockdown
Test Automation with Selenide
Corporate Sponsors
Corporate SponsorsKnowledge PartnerOrganized by
Isuru Madanayaka
Senior Quality Engineer : ISM- APAC
linkedin.com/in/isuru-madanayaka-03b36425
hims.rc@gmail.com
Test Automation with
Selenide–
What is Selenide
Selenide is a framework for test automation
powered by Selenium webdriver
Author - Andrei Solntsev
Why Selenide ?
 Concise fluent API for tests
 Ajax support for stable tests
 Powerful selectors
 Simple configuration
Let's See !
Step 1
Selenide comes to us as a java library
You can either,
1. Use the library by directly adding that to your selenium java project as an
external.jar file or
2. You can use the maven dependency related to the selenide library in your
maven project.
Either way you can enjoy the powers of Selenide !
Step 1
You can download the .jar file using below link
https://search.maven.org/search?q=g:com.codeborne%20AND%20a:selenide
Or Maven dependency from here
https://selenide.org/quick-start.html
Let’s get into the real
ACTION !
Hands on …
Three simple steps
1. open(page)
2. $(element).doAction()
3. $(element).check(condition)
Selectors & main
methods
Selectors & Main Methods
• $(String cssSelector) – returns object of the SelenideElement class that
represents first element found by CSS selector on the page.
• $(By) – returns "first SelenideElement" by the locator of the By class.
• $$(String cssSelector) – returns object of type ElementsCollection that
represents collection of all elements found by a CSS selector
• $$(By) – returns "collection of elements" by the locator of By type.
Contd …
Usually, when you get a SelenideElement object by the Dollar $ command, you can
• perform some action on it:
$(byText("Sign in")).click();
• or even several actions at once:
$(byName("password")).setValue("qwerty").pressEnter();
• or you can check some condition:
$(".welcome-message").shouldHave(text("Welcome, user!"))
Contd …
"Double Dollar" command ( $$ ) can be useful when a needed element is a one of a
same type.
For example, instead of:
$(byXpath("//*[@id='search-results']//a[contains(text(),'selenide.org')]")).click();
you can use more readable and verbose alternative:
$$("#search-results a").findBy(text("selenide.org")).click();
You perform the same action BUT 2nd method will increase
• Readability
• Debuggability
Selenide general
methods
General Selenide methods
Selenide. …
• sleep()
• refresh()
• title()
• back()
• forward()
• download()
• confirm()
And many more interesting actions …
Selenide Elements
Selenide Element !
The “SelenideElement” class is a wrapper over Selenium WebElement that adds
some rather useful methods
It’s a proxy element !
You can,
• Access the inner element
• Check the state
• Perform actions
• Access element attributes
Contd …!
Both $ and $$ methods returns,
Proxy elements
Hence,
It doesn’t need to be real at the beginning
Thus,
You can create a locator chain
$("#header").find("#menu").findAll(".item")
Contd …!
You can perform following actions on the selenide elements
• click()
• doubleClick()
• contextClick()
• hover()
• setValue(String) | val(String)
• pressEnter()
• pressEscape()
• pressTab()
• selectRadio(String value)
• selectOption(String)
• append(String)
• dragAndDropTo(String)
And many more …
Contd …!
You can get selenide element statuses via following methods …
• getValue() | val()
• data()
• attr(String)
• text() // returns "visible text on a page"
• innerText() // returns "text of element in DOM"
• getSelectedOption()
• getSelectedText()
• getSelectedValue()
•
And many more …
Conditions !
Selenide Conditions
You can impose different types of conditions on selenide elements via
Should(Condition …)
ShouldBe(Condition …)
ShouldHave(Condition …)
ShouldNot(Condition …)
And few more …
Contd …
visible | appear // e.g. $("input").shouldBe(visible) (instead of
$("input").shouldBe(Condition.visible))
present | exist // conditions to wait for element existence in DOM (it can be still
hidden)
hidden | disappear | not(visible)
readonly // e.g. $("input").shouldBe(readonly)
name // e.g. $("input").shouldHave(name("fname"))
And many more …
Selenide Selectors
Selectors
• byText - search element by exact text
• withText - search element by contained text (substring)
• byTitle - search by attribute "title"
• byValue - search by attribute "value"
• by(attributeName, attributeValue) - search by attribute's name and value
• byXpath
• etc.
Selenide Collections
Element Collections
The object of this class is also a "proxy", the same way as object of SelenideElement
class. This object can be created by calling the $$ method and represents the list of
web-elements on the page.
Assertions on collections
Trigger the search of the actual elements on the page for the proxy-collection,
performs the check based on collection condition, returns the object of
ElementsCollection class
$$(".errors").shouldBe(empty)
$$("#mytable tbody tr").shouldHave(size(2))
Contd
Methods to get statues and attributes of elements collection
size()
isEmpty()
getTexts() - e.g - <li>a</li><li hidden>b</li><li>c</li> OUTPUT ?
Contd
Methods-selectors of specific collection elements
filterBy(Condition) e.g - $$("#multirowTable tr").filterBy(text("Norris"))
excludeWith(Condition) - e.g. $$("#multirowTable tr").excludeWith(text("Chuck"))
get(int)
findBy(Condition) - OUTPUT – element ? Element collection ?
Contd
Collection Conditions
Collection conditions are used in the shouldBe/shouldHave constructs for the
object of ElementsCollection class
• empty // e.g. $$("#list li").shouldBe(empty)
• size(int) // e.g. $$("#list li").shouldHave(size(10))
• sizeGreaterThan(int)
• sizeGreaterThanOrEqual(int)
• sizeLessThan(int) sizeLessThanOrEqual(int)
And some more …
WebDriver Runner
WebDriver Runner
This class defines some browser management methods:
isChrome()
isFirefox()
isHeadless()
url() - returns current url
source() - returns source HTML code of current page
WebDriver Runner
If in case, you want to access the raw selenium
getWebDriver()
setWebDriver(WebDriver)
Selenide
Configuration !
Configuration
Timeout
Configuration.timeout=<milliSeconds>
Configuration.collectionTimeout=<milliSeconds>
browser (e.g. "chrome" , "ie" , "firefox" )
baseUrl
Additionally, it is possible to pass configuration options as system properties e.g.
when configuration tests execution on CI servers.
References
Official site
https://selenide.org/index.html
Selenide broadcast
https://selenide.org/blog.html
Selenide API
https://selenide.org/javadoc/current/
Selenide latest .jar file
https://search.maven.org/search?q=g:com.codeborne%20AND%20a:selenide
Thank You !

Contenu connexe

Tendances (20)

jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
Jquery
JqueryJquery
Jquery
 
jQuery
jQueryjQuery
jQuery
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009
 
Protractor Training in Pune by QuickITDotnet
Protractor Training in Pune by QuickITDotnet Protractor Training in Pune by QuickITDotnet
Protractor Training in Pune by QuickITDotnet
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery Presentation
 
Jquery introduction
Jquery introductionJquery introduction
Jquery introduction
 
Learn css3
Learn css3Learn css3
Learn css3
 
jQuery introduction
jQuery introductionjQuery introduction
jQuery introduction
 
jQuery Selectors
jQuery SelectorsjQuery Selectors
jQuery Selectors
 
How to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQueryHow to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQuery
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
 
Jquery-overview
Jquery-overviewJquery-overview
Jquery-overview
 
jQuery Basic API
jQuery Basic APIjQuery Basic API
jQuery Basic API
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
Jquery
JqueryJquery
Jquery
 

Similaire à Weekly Webinars on Test Automation with Selenide

Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Marakana Inc.
 
2010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-62010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-6Marakana Inc.
 
Escape from the automation hell
Escape from the automation hellEscape from the automation hell
Escape from the automation hellNikita Simonovets
 
Design Summit - Navigating the ManageIQ Object Model - Brad Ascar
Design Summit - Navigating the ManageIQ Object Model - Brad AscarDesign Summit - Navigating the ManageIQ Object Model - Brad Ascar
Design Summit - Navigating the ManageIQ Object Model - Brad AscarManageIQ
 
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect ModelComprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect ModelvodQA
 
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...Iakiv Kramarenko
 
Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Rakesh Jha
 
Selenium WebDriver with Java
Selenium WebDriver with JavaSelenium WebDriver with Java
Selenium WebDriver with JavaFayis-QA
 
Object identification and its management
Object identification and its managementObject identification and its management
Object identification and its managementVinay Kumar Pulabaigari
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryZeeshan Khan
 
Breaking the limits_of_page_objects
Breaking the limits_of_page_objectsBreaking the limits_of_page_objects
Breaking the limits_of_page_objectsRobert Bossek
 
FFW Gabrovo PMG - jQuery
FFW Gabrovo PMG - jQueryFFW Gabrovo PMG - jQuery
FFW Gabrovo PMG - jQueryToni Kolev
 
Don't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQueryDon't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQueryshabab shihan
 
Selenide review and how to start using it in legacy Selenium tests
Selenide review and how to start using it in legacy Selenium testsSelenide review and how to start using it in legacy Selenium tests
Selenide review and how to start using it in legacy Selenium testsProvectus
 

Similaire à Weekly Webinars on Test Automation with Selenide (20)

Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6
 
2010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-62010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-6
 
Escape from the automation hell
Escape from the automation hellEscape from the automation hell
Escape from the automation hell
 
Selenium Overview
Selenium OverviewSelenium Overview
Selenium Overview
 
Real World MVC
Real World MVCReal World MVC
Real World MVC
 
Design Summit - Navigating the ManageIQ Object Model - Brad Ascar
Design Summit - Navigating the ManageIQ Object Model - Brad AscarDesign Summit - Navigating the ManageIQ Object Model - Brad Ascar
Design Summit - Navigating the ManageIQ Object Model - Brad Ascar
 
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect ModelComprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
 
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
 
Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap
 
Selenium WebDriver with Java
Selenium WebDriver with JavaSelenium WebDriver with Java
Selenium WebDriver with Java
 
Object identification and its management
Object identification and its managementObject identification and its management
Object identification and its management
 
Jquery
JqueryJquery
Jquery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Breaking the limits_of_page_objects
Breaking the limits_of_page_objectsBreaking the limits_of_page_objects
Breaking the limits_of_page_objects
 
FFW Gabrovo PMG - jQuery
FFW Gabrovo PMG - jQueryFFW Gabrovo PMG - jQuery
FFW Gabrovo PMG - jQuery
 
Angular JS
Angular JSAngular JS
Angular JS
 
Don't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQueryDon't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQuery
 
JQuery
JQueryJQuery
JQuery
 
JQuery
JQueryJQuery
JQuery
 
Selenide review and how to start using it in legacy Selenium tests
Selenide review and how to start using it in legacy Selenium testsSelenide review and how to start using it in legacy Selenium tests
Selenide review and how to start using it in legacy Selenium tests
 

Dernier

chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Intelisync
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 

Dernier (20)

chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 

Weekly Webinars on Test Automation with Selenide

  • 1. Lockdown Technical Webinars Weekly Webinars for Undergraduates while in Lockdown Test Automation with Selenide Corporate Sponsors Corporate SponsorsKnowledge PartnerOrganized by
  • 2. Isuru Madanayaka Senior Quality Engineer : ISM- APAC linkedin.com/in/isuru-madanayaka-03b36425 hims.rc@gmail.com
  • 4. What is Selenide Selenide is a framework for test automation powered by Selenium webdriver Author - Andrei Solntsev
  • 5. Why Selenide ?  Concise fluent API for tests  Ajax support for stable tests  Powerful selectors  Simple configuration
  • 7. Step 1 Selenide comes to us as a java library You can either, 1. Use the library by directly adding that to your selenium java project as an external.jar file or 2. You can use the maven dependency related to the selenide library in your maven project. Either way you can enjoy the powers of Selenide !
  • 8. Step 1 You can download the .jar file using below link https://search.maven.org/search?q=g:com.codeborne%20AND%20a:selenide Or Maven dependency from here https://selenide.org/quick-start.html
  • 9. Let’s get into the real ACTION !
  • 10. Hands on … Three simple steps 1. open(page) 2. $(element).doAction() 3. $(element).check(condition)
  • 12. Selectors & Main Methods • $(String cssSelector) – returns object of the SelenideElement class that represents first element found by CSS selector on the page. • $(By) – returns "first SelenideElement" by the locator of the By class. • $$(String cssSelector) – returns object of type ElementsCollection that represents collection of all elements found by a CSS selector • $$(By) – returns "collection of elements" by the locator of By type.
  • 13. Contd … Usually, when you get a SelenideElement object by the Dollar $ command, you can • perform some action on it: $(byText("Sign in")).click(); • or even several actions at once: $(byName("password")).setValue("qwerty").pressEnter(); • or you can check some condition: $(".welcome-message").shouldHave(text("Welcome, user!"))
  • 14. Contd … "Double Dollar" command ( $$ ) can be useful when a needed element is a one of a same type. For example, instead of: $(byXpath("//*[@id='search-results']//a[contains(text(),'selenide.org')]")).click(); you can use more readable and verbose alternative: $$("#search-results a").findBy(text("selenide.org")).click(); You perform the same action BUT 2nd method will increase • Readability • Debuggability
  • 16. General Selenide methods Selenide. … • sleep() • refresh() • title() • back() • forward() • download() • confirm() And many more interesting actions …
  • 18. Selenide Element ! The “SelenideElement” class is a wrapper over Selenium WebElement that adds some rather useful methods It’s a proxy element ! You can, • Access the inner element • Check the state • Perform actions • Access element attributes
  • 19. Contd …! Both $ and $$ methods returns, Proxy elements Hence, It doesn’t need to be real at the beginning Thus, You can create a locator chain $("#header").find("#menu").findAll(".item")
  • 20. Contd …! You can perform following actions on the selenide elements • click() • doubleClick() • contextClick() • hover() • setValue(String) | val(String) • pressEnter() • pressEscape() • pressTab() • selectRadio(String value) • selectOption(String) • append(String) • dragAndDropTo(String) And many more …
  • 21. Contd …! You can get selenide element statuses via following methods … • getValue() | val() • data() • attr(String) • text() // returns "visible text on a page" • innerText() // returns "text of element in DOM" • getSelectedOption() • getSelectedText() • getSelectedValue() • And many more …
  • 23. Selenide Conditions You can impose different types of conditions on selenide elements via Should(Condition …) ShouldBe(Condition …) ShouldHave(Condition …) ShouldNot(Condition …) And few more …
  • 24. Contd … visible | appear // e.g. $("input").shouldBe(visible) (instead of $("input").shouldBe(Condition.visible)) present | exist // conditions to wait for element existence in DOM (it can be still hidden) hidden | disappear | not(visible) readonly // e.g. $("input").shouldBe(readonly) name // e.g. $("input").shouldHave(name("fname")) And many more …
  • 26. Selectors • byText - search element by exact text • withText - search element by contained text (substring) • byTitle - search by attribute "title" • byValue - search by attribute "value" • by(attributeName, attributeValue) - search by attribute's name and value • byXpath • etc.
  • 28. Element Collections The object of this class is also a "proxy", the same way as object of SelenideElement class. This object can be created by calling the $$ method and represents the list of web-elements on the page. Assertions on collections Trigger the search of the actual elements on the page for the proxy-collection, performs the check based on collection condition, returns the object of ElementsCollection class $$(".errors").shouldBe(empty) $$("#mytable tbody tr").shouldHave(size(2))
  • 29. Contd Methods to get statues and attributes of elements collection size() isEmpty() getTexts() - e.g - <li>a</li><li hidden>b</li><li>c</li> OUTPUT ?
  • 30. Contd Methods-selectors of specific collection elements filterBy(Condition) e.g - $$("#multirowTable tr").filterBy(text("Norris")) excludeWith(Condition) - e.g. $$("#multirowTable tr").excludeWith(text("Chuck")) get(int) findBy(Condition) - OUTPUT – element ? Element collection ?
  • 31. Contd Collection Conditions Collection conditions are used in the shouldBe/shouldHave constructs for the object of ElementsCollection class • empty // e.g. $$("#list li").shouldBe(empty) • size(int) // e.g. $$("#list li").shouldHave(size(10)) • sizeGreaterThan(int) • sizeGreaterThanOrEqual(int) • sizeLessThan(int) sizeLessThanOrEqual(int) And some more …
  • 33. WebDriver Runner This class defines some browser management methods: isChrome() isFirefox() isHeadless() url() - returns current url source() - returns source HTML code of current page
  • 34. WebDriver Runner If in case, you want to access the raw selenium getWebDriver() setWebDriver(WebDriver)
  • 36. Configuration Timeout Configuration.timeout=<milliSeconds> Configuration.collectionTimeout=<milliSeconds> browser (e.g. "chrome" , "ie" , "firefox" ) baseUrl Additionally, it is possible to pass configuration options as system properties e.g. when configuration tests execution on CI servers.
  • 37. References Official site https://selenide.org/index.html Selenide broadcast https://selenide.org/blog.html Selenide API https://selenide.org/javadoc/current/ Selenide latest .jar file https://search.maven.org/search?q=g:com.codeborne%20AND%20a:selenide