Web Driver Cheat Sheet
Web Driver Cheat Sheet
Web Driver Cheat Sheet
IntelliJ Tips
Contact Details
API Overview
http://www.mindmeister.com/280141421/selenium-2-webdriver-commands
http://www.mindmeister.com/280141421/selenium-2-webdriver-commands
WebElement
Interrogation
Basics
http://www.mindmeister.com/280141421/selenium-2-webdriver-commands
WebElement
Manipulation
http://www.mindmeister.com/280141421/selenium-2-webdriver-commands
Synchronisation
HTML, Web
Domain
Basic API
IntelliJ Tips
Switch on AutoScroll
Find Symbol
Find Class
Find File
Shift + Ctnrl + N
Synchronisation WebDriverWait
Custom ExpectedCondition
new WebDriverWait(driver,10).until(
optionWithValueDisplayed(By.id("combo2"),"Java") );
private ExpectedCondition<WebElement>
optionWithValueDisplayed(
final String value) {
};
@Override
public WebElement apply(WebDriver webDriver) {
return webDriver.findElement(
By.cssSelector("option[value='" + value + "']") );
}
10
SlowLoadableCompnent
Public interface
get()
extends SlowLoadableComponent<PageObjectClassName>
is
not
Number
greaterThan,
greaterThanOrEqualTo,
lessThan,
lessThanOrEqualTo - test
ordering
Text
equalToIgnoringCase
equalToIgnoringWhiteSpace
containsString,
endsWith,
startsWith
Collections
hasEntry,
hasKey,
hasItem,
notNullValue,
nullValue - test for null
http://code.google.com/p/hamcrest/wiki/Tutorial#A_tour_of_common_matchers
XPATH Selectors
Selectors
CSS Selectors
// - match anywhere
* - any
#id
.class
//tag
tag
//*[@attribute]
[attribute]
//*[@attribute="value"]
[attribute="value"]
//tag[@attribute="value"]
tag[attribute="value"]
//tag1/tag2
(child)
tag[attr1='val1'][attr2='val2']
//tag1//tag2
(any descendant)
tag[att1='val1'], orThisTag
//tag1/../..
(.. to go up)
//*[.='element text']
[@at1="a" and @at2="b"]
and, or, =, !=, <, >, >=, <-
Functions
= (' or ")
*="anywhere in value"
^="start of value"
$="end of value"
~="spaceSeperatedValue"
contains(@a,"alu")
Paths
starts-with(@a,"v")
A > B (child)
ends-with(@a,"e")
A B (any descendant)
Indexing
//tag[1]
A + B (A's B sibling)
tag:first-child
CSS References
http://reference.sitepoint.com/css/selectorref
http://net.tutsplus.com/tutorials/html-css-techniques/
the-30-css-selectors-you-must-memorize/
http://www.quirksmode.org/css/contents.html
http://www.w3schools.com/cssref/css_selectors.asp
13
XPath References
http://www.w3schools.com/xpath/
http://www.simple-talk.com/dotnet/.net-framework/xpath,-css,-dom-and-selenium-the-rosetta-stone/
uk.linkedin.com/in/eviltester
Intro to Selenium
Unow.be/at/udemy101
Unow.be/at/udemystart
Unow.be/at/udemyapi
Videos
youtube.com/user/EviltesterVideos
SeleniumSimplified.com
EvilTester.com
Books
Selenium Simplified
CompendiumDev.co.uk
Unow.be/rc/selsimp
Twitter: @eviltester
14