What is the taste of the Selenide

34
What is the taste of the Selenide? MARINSKY ROMA TICKETS.UA

Transcript of What is the taste of the Selenide

Page 1: What is the taste of the Selenide

What is the taste of

the Selenide?MARINSKY ROMA

TICKETS.UA

Page 2: What is the taste of the Selenide

Selenium

Selenium is an umbrella project encapsulating a variety

of tools and libraries enabling web browser automation

WebDriver, Selenium IDE, Selenium Grid

W3C WebDriver specification

Page 3: What is the taste of the Selenide

Selenium

Need allot of boilerplate for:

Init browsers

Wait for availability of any elements

Screenshots

Logs

Upload and download files

PageObject and PageFactory

Page 4: What is the taste of the Selenide

Wrapper around Selenium WebDriver not a framework

Fluent API for simple using all features

Supporting AJAX for stable tests, forgot: StaleElementExaptions

Simple waiting for any conditions for each element

Multifunctional Selectors

Simple Configurations for project with tests

Page 5: What is the taste of the Selenide

UI Tests: Selenide

Page 6: What is the taste of the Selenide

Selenide.class

$(css), $(By by), $x(xpath), $(By, index)

$$(css), $$(By by), $$x(xpath)

open(…) //URL, Login, PF

selectRadio(By, withText)

switchTo()

page() //for PageFactory *initElements(.class)*

Page 7: What is the taste of the Selenide
Page 8: What is the taste of the Selenide

Selenide.class

executeJavaScript()

actions()

Wait()

clearAllCookies()

clearLocalStorage()

zoom()

screenshot()

Page 9: What is the taste of the Selenide
Page 10: What is the taste of the Selenide

SelenideElement actions

followLink(), click(), contextClick()

setValue(string), val(), append()

uploadFile()

selectOption(By, text)

scrollTo(), hover(), dragAndDrop()

getText(), getValue(), getAttribute()

Page 11: What is the taste of the Selenide
Page 12: What is the taste of the Selenide

Should’ы and Wait’ы

should(Condition condition)

shouldHave()

shouldBe()

shouldNot(Condition condition)

shouldNotHave()

shouldNotBe()

waitUntil(Condition, timeout, pooling)

waitWhile(Condition, timeout, pooling)

waitUntil(Condition, timeout)

waitWhile(Condition, timeout)

Page 13: What is the taste of the Selenide
Page 14: What is the taste of the Selenide

ElementCollection actions

shouldHaveSize(Condition)

get(index), first(), last()

filter(Condition), filterBy(Condition) -> collection

find(Condition), findBy(Condition) -> element

exclude(Condition), excludeBy(Condition)

Page 15: What is the taste of the Selenide
Page 16: What is the taste of the Selenide

Conditions

visible, appear

exist, present

hidden, disappear

attribute(), attribute(name, value)

value(), name(), type(), id(), cssClass()

empty

matchText(regex), text(), exactText(), textCaseSensitive(), exactTextCaseSensitive()

focused, enabled, disabled,

selected, checked, readOnly

not(Condition), and(because,Condition),

or(because, Condition), be(), have()

Page 17: What is the taste of the Selenide
Page 18: What is the taste of the Selenide

CollectionConditions

get()

size(), sizeGreaterThan(),

sizeGreaterThanOrEqual()

sizeLessThan(),

sizeLessThanOrEqaul(), sizeNotEqual()

texts(…), exactTexts(…)

empty

Page 19: What is the taste of the Selenide
Page 20: What is the taste of the Selenide

WebDriverRunner

isFirefox, isHtmlUnit, isChrome, isSafari,

isHeadless, isEdge…

source()

url(), currentFrameUrl()

clearBrowserCache()

supportsModalDialogs(),

supportsJavascript()

Browser name constants(chrome,ff...)

addListeners(WebDriverEventListener)

setWebDriver(customDriver),

closeWebDriver()

getWebDriver(),

getAndCheckWebDriver(),

hasWebDriverStarted()

setProxy()

Page 21: What is the taste of the Selenide

Configuration

clickViaJs, fastSetValue

captureJsErrors

screenshots, savePageSource,

reportFolder, reportsUrl

dismissModalDialogs

selectorMode [css, sizzle]

assertionMode [soft, strict]

fileDownload [httpget, proxy]

baseUrl, browser

timeout, collectionTimeout

poolingInterval,

coollectionPoolingInterval

holdBrowserOpen,

reopenBrowserOnFail,

closeBrowserMs

remote

browserSize, startMaximized

Page 22: What is the taste of the Selenide

Extra selectors and parent

selectors withText(), byText()

byAttribute(), by()

byTitle(), byValue(), byId(), byName()

byXpath()

byLinkText(), byPartialLinkText()

byCssSelector()

byClassName

$(“tr td.dig”).parent()

$(“tr td.dig”).closest(“th”)

Page 23: What is the taste of the Selenide

Bonus features #1

Configuration.fileDownload = PROXY;

File testFile = $(“#file”).download();

Download files via proxy

Use when form have no href or other url

for start downloading file

Download file starts after click on the

form.

Will starts proxy server witch intercepts

downloading files

Page 24: What is the taste of the Selenide

Bonus features #2

You can use:

LoginForm loginForm = new LoginForm();

loginForm.submit.click();

Instead of:

LoginForm loginForm = page(LoginForm.class);

loginForm.submit.click();

Selenide PageFactory

You can use:

SelenideElement submit = $(“#submit”),

loginInput = $(“input.login”);

Instead of:

@FindBy(css=“#submit”)

SelenideElement submit;

@FindBy(css=“input.login”)

SelenideElement loginInput;

Page 25: What is the taste of the Selenide

Bonus features #3

Simple Logger

When you need logging all element actions do not use log4j and others

Use:

@Rule || @Listener

public TextReport = new TextReport();

Or

new TextReport().onFailedTest(true)

.onSucceededTest(false)

Page 26: What is the taste of the Selenide
Page 27: What is the taste of the Selenide
Page 28: What is the taste of the Selenide

Bonus features #4

Screenshots

When you need screenshots on each

fail test or more

Use:@Rule || @Listenerpublic ScreenShooter = ScreenShooter.failedTests();

Or: ScreenShooter.failedTests(). succeededTests();

Page 29: What is the taste of the Selenide
Page 30: What is the taste of the Selenide

How to start?

Include dependencies: selenide & webdrivermanager

Use static imports for Selenide’s methods

Keep it simple stupid!

Page 31: What is the taste of the Selenide

WebDriver Manager

https://github.com/bonigarcia/webdrivermanager

Page 32: What is the taste of the Selenide

Myths about Selenide

Will be it enterprise? – No

Selenide will do tests slower! – No

Need to know Selenium at the first! – No

Selenide it isn’t OOP framework! – No

Does not have typed elements! – So what?

It’s boilerplate

Page 33: What is the taste of the Selenide

Links & contacts

github.com/rmarinsky

fb.com/newromka

ru.selenide.org

software-testers.herokuapp.com

automated-testing.info/

Page 34: What is the taste of the Selenide

Thank you for attention

Questions?