SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
Volodymyr Zdvizhkov
Senior Automation Engineer
3
• Selenium IDE - a Chrome and Firefox add-on that will do
simple record-and-playback of interactions with the
browser. Scripts are recorded in the Selenium-specific
scripting language Selenese
• Selenium-Grid allows you run your tests on different remote
machines against different browsers in parallel. Selenium
Grid is a server that allows tests to use web browser
instances running on remote machines
• Selenium WebDriver - a collection of language specific
bindings to drive a browser- the way it is meant to be driven
4
• Selenide is a framework for writing easy-to-read and easy-
to-maintain automated tests in Java. It defines concise tests
at the same time against different browsers and operating
systems
• Selenoid is a powerful Go implementation of original Selenium hub code
5
• Most common UI automation issues
• Motivation to create new framework
• Selenide features
• Web application to be tested
• Test cases to be covered
• Framework structure
• Pom xml dependencies
• Setting up framework from scratch
Not stable. Flaky tests
6
Reasons of 90%* flaky tests:
• Ajax requests: speed
• Ajax requests: ordering
• JS speed
*= "https://www.youtube.com/watch?v=jLG3RXECQU8”
Need of permanent maintenance
7
• NoSuchElementException - unable to locate element
{"method":"xpath","selector“: “someSelector”}
• StaleElementException - generally this is due to the
DOM being updated and you trying to access an
updated/new element - but the DOM's refreshed so
it's an invalid reference you have.
Automation framework architecture complexity
8
Why always me?
Bad descriptions are easy to write
9
Message: Expected: True But was: False
• Home page should be opened.
• Home page should be opened. Current url: https:://url
• Home page is not visible.
• Home page is not displayed. But should be
• User is not redirected to Home page
10
The most common tool for UI tests in
Java today is Selenium WebDriver.
Selenium WebDriver is a great tool, but
it’s not a tool for testing. It’s a tool for
browser manipulation.
11
Serenity helps you to write cleaner and more maintainable
automated acceptance and regression tests faster. Serenity
also uses the test results to produce illustrated, narrative
reports that document and describe what your application
does and how it works.
12
Cucumber is a software tool used by computer
programmers for testing other software. It runs
automated acceptance tests written in a behavior-
driven development (BDD) style.
13
Galen Framework might be a perfect fit for your
needs if your automation efforts are focused on
user experience design (UX) or layout testing for
responsive websites.
14
How about Selenide?
15
Selenide is a tool for writing concise, expressive and stable UI tests in Java.
16
• Free, open-source
• Makes your tests shorter and more readable
• Ajax support, smart waiting
• Simple configuration
• Automated screenshots
• Pre-setup browser (transparent webDriver)
• Soft assertions
17
The most annoying problem of UI Tests is timeouts
driver.manage().timeouts().implicityWait(10, TimeUnit.SECONDS);
actions
checks
WebDriverWait wait = new WebDriverWait(driver, 10000);
wait.until(ExpectedConditions.presenceOfElementLocated
(By.id("id“));
waitUntil(appear, 20000)
Configuration.timeout = 10000;
Our goal is to emulate user
18
• byText() – find element with given text (the whole text, not substring)
• withText() – find element containing given text (as substring)
Poor software doesn't have documentation. Brilliant software doesn't need documentation
19
Do Action Check
Keep it simple
Transparent WebDriver
20
You don’t need to set up WebDriver logic directly. Selenide will
start and shut down the browser automatically whenever it’s
needed.
Just use:
• open(string url) - The main starting point in your tests.
Open a browser window with given URL
• close() - Close the browser if it's open
Most popular browsers supported: Chrome, Firefox, Ie, Safari,
Opera, etc.
Run browser command: -Dselenide.browser=browserName.
Concise fluent API for tests
21
• shouldHave(textCaseSensitive(String substring));
• dragAndDropTo(String selector);
• sizeLessThanOrEqual(); sizeNotEqual(); sizeGreaterThan();
• atBottom();
• executeJavaScript(String jsCode, Object… arguments);
• doubleClick();
• shouldHave(exactTextCaseSensitive(String text));
• pressEnter(); pressEscape(); pressTab();
Concise fluent API for tests
22
• matchesText() - assert that given element's text matches given regular expression
• empty() - for input element/other element, check that value is missing or empty
• present(); exist(); – returns true if element is present in DOM, otherwise – false
• hidden(); disappear(); not(visible) - checks that element is not visible / not exists
• be(), have() – are used to form human-readable condition
• download(); uploadFile();
• isImage() - returns true if the image is properly loaded
• getSelectedRadio() - returns selected element in radio group
Selenide takes screenshots automatically on every test failure
23
Configure by system property: -Dselenide.screenshots = true;
or programmatically:
above class: @Listeners({ScreenShooter.class}),
inside method/constructor: ScreenShooter.captureSuccessfulTests = true;
By default Selenide puts screenshots to folder: build/reports/tests.
Change directory: Dselenide.reportsFolder = test-result/reports
Additionally, you can take screenshot at any moment with a single
line of code: Screenshot(“my_file_name);
24
Selenide provides point to perform built in verification softly -
this means that Selenide will skip failed verification and collect
all of it and throw error only at the end of test. Available for
TestNG, JUnit4 and Junit5.
All the checks like: $.shouldHave(text("xxx")) will collect
errors and report all them at once. It could be useful if cost of
running tests is too big for you.
Above class: @Listeners({ SoftAsserts.class})
Inside test: Configuration.assertionMode = SOFT;
25
26
Write automation tests for:
27
28
Page objects
Tests
Test steps
Initialize Selenide elements
29
Initialize by elements Return Selenide element in method
30
31

Weitere ähnliche Inhalte

Was ist angesagt?

Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
shreyas JC
 

Was ist angesagt? (20)

Selenium Grid
Selenium GridSelenium Grid
Selenium Grid
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Selenium
SeleniumSelenium
Selenium
 
An overview of selenium webdriver
An overview of selenium webdriverAn overview of selenium webdriver
An overview of selenium webdriver
 
Selenium WebDriver with C#
Selenium WebDriver with C#Selenium WebDriver with C#
Selenium WebDriver with C#
 
Automation Testing by Selenium Web Driver
Automation Testing by Selenium Web DriverAutomation Testing by Selenium Web Driver
Automation Testing by Selenium Web Driver
 
Web automation using selenium.ppt
Web automation using selenium.pptWeb automation using selenium.ppt
Web automation using selenium.ppt
 
SELENIUM PPT.pdf
SELENIUM PPT.pdfSELENIUM PPT.pdf
SELENIUM PPT.pdf
 
Selenium
SeleniumSelenium
Selenium
 
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Selenium
 
Introduction to Selenium grid
Introduction to Selenium gridIntroduction to Selenium grid
Introduction to Selenium grid
 
Introduction to Selenium | Selenium Tutorial for Beginners | Selenium Trainin...
Introduction to Selenium | Selenium Tutorial for Beginners | Selenium Trainin...Introduction to Selenium | Selenium Tutorial for Beginners | Selenium Trainin...
Introduction to Selenium | Selenium Tutorial for Beginners | Selenium Trainin...
 
Selenium introduction
Selenium introductionSelenium introduction
Selenium introduction
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 
Automated testing using Selenium & NUnit
Automated testing using Selenium & NUnitAutomated testing using Selenium & NUnit
Automated testing using Selenium & NUnit
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Selenium Concepts
Selenium ConceptsSelenium Concepts
Selenium Concepts
 
Automated Web Testing Using Selenium
Automated Web Testing Using SeleniumAutomated Web Testing Using Selenium
Automated Web Testing Using Selenium
 
Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium Webdriver
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 

Ähnlich wie Selenide

#2 integration + ui tests
#2 integration + ui tests#2 integration + ui tests
#2 integration + ui tests
eleksdev
 
Test Automation Using Selenium
Test Automation Using SeleniumTest Automation Using Selenium
Test Automation Using Selenium
Nikhil Kapoor
 

Ähnlich wie Selenide (20)

Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
#2 integration + ui tests
#2 integration + ui tests#2 integration + ui tests
#2 integration + ui tests
 
Selenium (1) (1)
Selenium (1) (1)Selenium (1) (1)
Selenium (1) (1)
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium using Java
Selenium using JavaSelenium using Java
Selenium using Java
 
A Simple Guide to Selenium Software Testing
A Simple Guide to Selenium Software TestingA Simple Guide to Selenium Software Testing
A Simple Guide to Selenium Software Testing
 
Selenium
SeleniumSelenium
Selenium
 
Interview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlotInterview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlot
 
Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium
 
Selenium testing - Handle Elements in WebDriver
Selenium testing - Handle Elements in WebDriver Selenium testing - Handle Elements in WebDriver
Selenium testing - Handle Elements in WebDriver
 
Test Automation Using Selenium
Test Automation Using SeleniumTest Automation Using Selenium
Test Automation Using Selenium
 
Android Automation Testing with Selendroid
Android Automation Testing with SelendroidAndroid Automation Testing with Selendroid
Android Automation Testing with Selendroid
 
Automation Testing
Automation TestingAutomation Testing
Automation Testing
 

Mehr von DataArt

Digital Marketing from inside
Digital Marketing from insideDigital Marketing from inside
Digital Marketing from inside
DataArt
 
A. Sirota "Building an Automation Solution based on Appium"
A. Sirota "Building an Automation Solution based on Appium"A. Sirota "Building an Automation Solution based on Appium"
A. Sirota "Building an Automation Solution based on Appium"
DataArt
 
Эмоциональный интеллект или как не сойти с ума в условиях сложного и динамичн...
Эмоциональный интеллект или как не сойти с ума в условиях сложного и динамичн...Эмоциональный интеллект или как не сойти с ума в условиях сложного и динамичн...
Эмоциональный интеллект или как не сойти с ума в условиях сложного и динамичн...
DataArt
 

Mehr von DataArt (20)

DataArt Custom Software Engineering with a Human Approach
DataArt Custom Software Engineering with a Human ApproachDataArt Custom Software Engineering with a Human Approach
DataArt Custom Software Engineering with a Human Approach
 
DataArt Healthcare & Life Sciences
DataArt Healthcare & Life SciencesDataArt Healthcare & Life Sciences
DataArt Healthcare & Life Sciences
 
DataArt Financial Services and Capital Markets
DataArt Financial Services and Capital MarketsDataArt Financial Services and Capital Markets
DataArt Financial Services and Capital Markets
 
About DataArt HR Partners
About DataArt HR PartnersAbout DataArt HR Partners
About DataArt HR Partners
 
Event management в IT
Event management в ITEvent management в IT
Event management в IT
 
Digital Marketing from inside
Digital Marketing from insideDigital Marketing from inside
Digital Marketing from inside
 
What's new in Android, Igor Malytsky ( Google Post I|O Tour)
What's new in Android, Igor Malytsky ( Google Post I|O Tour)What's new in Android, Igor Malytsky ( Google Post I|O Tour)
What's new in Android, Igor Malytsky ( Google Post I|O Tour)
 
DevOps Workshop:Что бывает, когда DevOps приходит на проект
DevOps Workshop:Что бывает, когда DevOps приходит на проектDevOps Workshop:Что бывает, когда DevOps приходит на проект
DevOps Workshop:Что бывает, когда DevOps приходит на проект
 
IT Talk Kharkiv: «‎Soft skills в IT. Польза или вред? Максим Бастион, DataArt
IT Talk Kharkiv: «‎Soft skills в IT. Польза или вред? Максим Бастион, DataArtIT Talk Kharkiv: «‎Soft skills в IT. Польза или вред? Максим Бастион, DataArt
IT Talk Kharkiv: «‎Soft skills в IT. Польза или вред? Максим Бастион, DataArt
 
«Ноль копеек. Спастись от выгорания» — Сергей Чеботарев (Head of Design, Han...
 «Ноль копеек. Спастись от выгорания» — Сергей Чеботарев (Head of Design, Han... «Ноль копеек. Спастись от выгорания» — Сергей Чеботарев (Head of Design, Han...
«Ноль копеек. Спастись от выгорания» — Сергей Чеботарев (Head of Design, Han...
 
Communication in QA's life
Communication in QA's lifeCommunication in QA's life
Communication in QA's life
 
Нельзя просто так взять и договориться, или как мы работали со сложными людьми
Нельзя просто так взять и договориться, или как мы работали со сложными людьмиНельзя просто так взять и договориться, или как мы работали со сложными людьми
Нельзя просто так взять и договориться, или как мы работали со сложными людьми
 
Знакомьтесь, DevOps
Знакомьтесь, DevOpsЗнакомьтесь, DevOps
Знакомьтесь, DevOps
 
DevOps in real life
DevOps in real lifeDevOps in real life
DevOps in real life
 
Codeless: автоматизация тестирования
Codeless: автоматизация тестированияCodeless: автоматизация тестирования
Codeless: автоматизация тестирования
 
Selenoid
SelenoidSelenoid
Selenoid
 
A. Sirota "Building an Automation Solution based on Appium"
A. Sirota "Building an Automation Solution based on Appium"A. Sirota "Building an Automation Solution based on Appium"
A. Sirota "Building an Automation Solution based on Appium"
 
Эмоциональный интеллект или как не сойти с ума в условиях сложного и динамичн...
Эмоциональный интеллект или как не сойти с ума в условиях сложного и динамичн...Эмоциональный интеллект или как не сойти с ума в условиях сложного и динамичн...
Эмоциональный интеллект или как не сойти с ума в условиях сложного и динамичн...
 
IT talk: Как я перестал бояться и полюбил TestNG
IT talk: Как я перестал бояться и полюбил TestNGIT talk: Как я перестал бояться и полюбил TestNG
IT talk: Как я перестал бояться и полюбил TestNG
 
Olga Dzeverina pm_day_pdf
Olga Dzeverina pm_day_pdfOlga Dzeverina pm_day_pdf
Olga Dzeverina pm_day_pdf
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 

Selenide

  • 1.
  • 3. 3 • Selenium IDE - a Chrome and Firefox add-on that will do simple record-and-playback of interactions with the browser. Scripts are recorded in the Selenium-specific scripting language Selenese • Selenium-Grid allows you run your tests on different remote machines against different browsers in parallel. Selenium Grid is a server that allows tests to use web browser instances running on remote machines • Selenium WebDriver - a collection of language specific bindings to drive a browser- the way it is meant to be driven
  • 4. 4 • Selenide is a framework for writing easy-to-read and easy- to-maintain automated tests in Java. It defines concise tests at the same time against different browsers and operating systems • Selenoid is a powerful Go implementation of original Selenium hub code
  • 5. 5 • Most common UI automation issues • Motivation to create new framework • Selenide features • Web application to be tested • Test cases to be covered • Framework structure • Pom xml dependencies • Setting up framework from scratch
  • 6. Not stable. Flaky tests 6 Reasons of 90%* flaky tests: • Ajax requests: speed • Ajax requests: ordering • JS speed *= "https://www.youtube.com/watch?v=jLG3RXECQU8”
  • 7. Need of permanent maintenance 7 • NoSuchElementException - unable to locate element {"method":"xpath","selector“: “someSelector”} • StaleElementException - generally this is due to the DOM being updated and you trying to access an updated/new element - but the DOM's refreshed so it's an invalid reference you have.
  • 8. Automation framework architecture complexity 8 Why always me?
  • 9. Bad descriptions are easy to write 9 Message: Expected: True But was: False • Home page should be opened. • Home page should be opened. Current url: https:://url • Home page is not visible. • Home page is not displayed. But should be • User is not redirected to Home page
  • 10. 10 The most common tool for UI tests in Java today is Selenium WebDriver. Selenium WebDriver is a great tool, but it’s not a tool for testing. It’s a tool for browser manipulation.
  • 11. 11 Serenity helps you to write cleaner and more maintainable automated acceptance and regression tests faster. Serenity also uses the test results to produce illustrated, narrative reports that document and describe what your application does and how it works.
  • 12. 12 Cucumber is a software tool used by computer programmers for testing other software. It runs automated acceptance tests written in a behavior- driven development (BDD) style.
  • 13. 13 Galen Framework might be a perfect fit for your needs if your automation efforts are focused on user experience design (UX) or layout testing for responsive websites.
  • 15. 15 Selenide is a tool for writing concise, expressive and stable UI tests in Java.
  • 16. 16 • Free, open-source • Makes your tests shorter and more readable • Ajax support, smart waiting • Simple configuration • Automated screenshots • Pre-setup browser (transparent webDriver) • Soft assertions
  • 17. 17 The most annoying problem of UI Tests is timeouts driver.manage().timeouts().implicityWait(10, TimeUnit.SECONDS); actions checks WebDriverWait wait = new WebDriverWait(driver, 10000); wait.until(ExpectedConditions.presenceOfElementLocated (By.id("id“)); waitUntil(appear, 20000) Configuration.timeout = 10000;
  • 18. Our goal is to emulate user 18 • byText() – find element with given text (the whole text, not substring) • withText() – find element containing given text (as substring)
  • 19. Poor software doesn't have documentation. Brilliant software doesn't need documentation 19 Do Action Check Keep it simple
  • 20. Transparent WebDriver 20 You don’t need to set up WebDriver logic directly. Selenide will start and shut down the browser automatically whenever it’s needed. Just use: • open(string url) - The main starting point in your tests. Open a browser window with given URL • close() - Close the browser if it's open Most popular browsers supported: Chrome, Firefox, Ie, Safari, Opera, etc. Run browser command: -Dselenide.browser=browserName.
  • 21. Concise fluent API for tests 21 • shouldHave(textCaseSensitive(String substring)); • dragAndDropTo(String selector); • sizeLessThanOrEqual(); sizeNotEqual(); sizeGreaterThan(); • atBottom(); • executeJavaScript(String jsCode, Object… arguments); • doubleClick(); • shouldHave(exactTextCaseSensitive(String text)); • pressEnter(); pressEscape(); pressTab();
  • 22. Concise fluent API for tests 22 • matchesText() - assert that given element's text matches given regular expression • empty() - for input element/other element, check that value is missing or empty • present(); exist(); – returns true if element is present in DOM, otherwise – false • hidden(); disappear(); not(visible) - checks that element is not visible / not exists • be(), have() – are used to form human-readable condition • download(); uploadFile(); • isImage() - returns true if the image is properly loaded • getSelectedRadio() - returns selected element in radio group
  • 23. Selenide takes screenshots automatically on every test failure 23 Configure by system property: -Dselenide.screenshots = true; or programmatically: above class: @Listeners({ScreenShooter.class}), inside method/constructor: ScreenShooter.captureSuccessfulTests = true; By default Selenide puts screenshots to folder: build/reports/tests. Change directory: Dselenide.reportsFolder = test-result/reports Additionally, you can take screenshot at any moment with a single line of code: Screenshot(“my_file_name);
  • 24. 24 Selenide provides point to perform built in verification softly - this means that Selenide will skip failed verification and collect all of it and throw error only at the end of test. Available for TestNG, JUnit4 and Junit5. All the checks like: $.shouldHave(text("xxx")) will collect errors and report all them at once. It could be useful if cost of running tests is too big for you. Above class: @Listeners({ SoftAsserts.class}) Inside test: Configuration.assertionMode = SOFT;
  • 25. 25
  • 26. 26
  • 30. Initialize by elements Return Selenide element in method 30
  • 31. 31