Java & Selenium - Dependencies

Selectors

Example Tests

Selenium - Helpful Methods

  Explanation Example
get() Navigate to a URL get("https://www.ultranauts.com")
getCurrentUrl() String value for URL of the current page driver.getCurrentUrl()
getTitle() String value for page/tab title driver.getTitle()
switchTo().alert() Set focus to a JavaScript alert driver.switchTo().alert()
close() Close the current browser window only driver.close()
quit() Close all windows & terminates the session driver.quit()
isDisplayed() True/false if an element is displayed or not driver.findElement(By.cssSelector("input[name='username']")).isDisplayed()
isEnabled() True/false if a user can interact with an element or not driver.findElement(By.cssSelector("input[name='username']")).isEnabled()
isSelected() True/false if a checkbox/dropdown/radio is chosen or not driver.findElement(By.cssSelector("input[name='username']")).isSelected()
navigate().back() Navigate the browser to the previous page driver.navigate().back()
navigate().forward() Navigate the browser to the next page driver.navigate().forward()
navigate().refresh() Refresh the browser driver.navigate().refresh()

Selenium - Practice Sites

Site Notes
http://the-internet.herokuapp.com/ Contains a variety of UI scenarios
https://www.saucedemo.com/ eCommerce demo with login, cart & checkout
http://automationpractice.com/ eCommerce practice site
https://www.techlistic.com/p/selenium-practice-form.html A practice form with many different elements
https://phptravels.com/demo/ Travel demo site with several scenarios

Selenium - Helpful Courses

Site NotesSorted ascending
Selenium Page Objects & Automation Course covering page object design & abstraction
Selenium Support Classes Course covering the support classes of WebDriver
Selenium Synchronization Strategies Course covering various strategies for WebDriver synchronization
Selenium Automation Frameworks Course with an overview of Selenium in Ruby, Node.js & Java

-- MayaMcKela - 08 Jun 2021
Topic revision: r10 - 08 Jun 2021, MayaMcKela
© 2020 Ultranauts - 75 Broad Street, 2nd Floor, Suite 206, New York, NY 10004 - info@ultranauts.co