Webdriver cheatsheets Summary Slides
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Webdriver cheatsheets Summary Slides

on

  • 24,575 views

A set of slides that you can use to 'cheatsheet' your way to Selenium 2 WebDriver mastery. I use these as handouts on my Selenium WebDriver training.

A set of slides that you can use to 'cheatsheet' your way to Selenium 2 WebDriver mastery. I use these as handouts on my Selenium WebDriver training.

Statistics

Views

Total Views
24,575
Views on SlideShare
3,042
Embed Views
21,533

Actions

Likes
3
Downloads
155
Comments
0

13 Embeds 21,533

http://seleniumsimplified.com 21474
http://www.youtube.com 17
http://www.linkedin.com 14
https://www.linkedin.com 7
http://translate.googleusercontent.com 5
http://www.mindmeister.com 3
http://abtasty.com 3
http://www.scoop.it 3
http://www.google.com 2
http://www.google.co.uk 2
http://digg.com 1
https://www.google.co.in 1
http://&_=1395845890009 HTTP 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Webdriver cheatsheets Summary Slides Presentation Transcript

  • 1. WebDriver API Cheat Sheets● A short set of Summary Cheat Sheets for HandsOn Working With WebDriver● Contents:– Basic API commands– Hamcrest matchers & Junit– IntelliJ Tips– CSS & Xpath Selectors– Contact DetailsSeleniumSimplified.com | compendiumdev.co.uk | eviltester.comCopyright Alan Richardson,Compendium Developments@eviltesterCreated to support our Selenium2 WebDriver Training Courses
  • 2. API Overviewhttp://www.mindmeister.com/280141421/selenium-2-webdriver-commands
  • 3. http://www.mindmeister.com/280141421/selenium-2-webdriver-commandsWebDriver Level Basics
  • 4. WebElementInterrogationBasicshttp://www.mindmeister.com/280141421/selenium-2-webdriver-commands
  • 5. http://www.mindmeister.com/280141421/selenium-2-webdriver-commandsWebElementManipulation
  • 6. Synchronisation
  • 7. HTML, WebDomain
  • 8. Basic API
  • 9. IntelliJ Tips● Use Code Completion● ctrl+Q for Documentation of Commands● ctrl+click to view the method code● Switch on AutoScroll● Find Symbol– Shift + Cntrl + Alt + N● Find Class– Cntrl + N● Find File– Shift + Ctnrl + N
  • 10. 10● ExpectedConditions static methods● Custom ExpectedConditionSynchronisation WebDriverWaitprivate ExpectedCondition<WebElement> optionWithValueDisplayed(final String value) {return new ExpectedCondition<WebElement>() {@Overridepublic WebElement apply(WebDriver webDriver) {return webDriver.findElement(By.cssSelector("option[value=" + value + "]") );}};}new WebDriverWait(driver,10).until(optionWithValueDisplayed(By.id("combo2"),"Java") );new WebDriverWait(driver,10).until(ExpectedConditions.titleIs("HTML Form Elements"));
  • 11. SlowLoadableCompnent● Public interface– get()● loads and waits for component to be availableextends SlowLoadableComponent<PageObjectClassName>● Call super constructor in constructorpublic PageObjectClassName(WebDriver driver) {super(new SystemClock(), 10);this.driver = driver;}● Implement load and isLoaded– isLoaded throws a new Error if not loaded– I often leave the load part empty if I navigate to the page
  • 12. ● @Test● @Before, @After (method level)● @BeforeClass, @AfterClass (static)Hamcrest Matchers & JUnit● is● not● Number– greaterThan,– greaterThanOrEqualTo,– lessThan,– lessThanOrEqualTo - testordering● Text– equalToIgnoringCase– equalToIgnoringWhiteSpace– containsString,– endsWith,– startsWith● Collections– hasEntry,– hasKey,– hasValue - test a map contains anentry, key or value– hasItem,– hasItems - test a collectioncontains elements– hasItemInArray - test an arraycontains an element● notNullValue,● nullValue - test for nullhttp://code.google.com/p/hamcrest/wiki/Tutorial#A_tour_of_common_matcherse.g. assertThat(driver.getTitle(), is(not(“bob”));
  • 13. 13Selectors CSS Selectors* - any#id.classtag[attribute][attribute="value"]tag[attribute="value"]tag[attr1=val1][attr2=val2]tag[att1=val1], orThisTag= ( or ")*="anywhere in value"^="start of value"$="end of value"~="spaceSeperatedValue"PathsA > B (child)A B (any descendant)A + B (As B sibling)tag:first-childXPATH Selectors// - match anywhere/ - match from root//* - any element//tag//*[@attribute]//*[@attribute="value"]//tag[@attribute="value"]//tag1/tag2 (child)//tag1//tag2 (any descendant)//tag1/../.. (.. to go up)//*[.=element text][@at1="a" and @at2="b"]and, or, =, !=, <, >, >=, <-Functionscontains(@a,"alu")starts-with(@a,"v")ends-with(@a,"e")Indexing//tag[1]XPath References● http://www.w3schools.com/xpath/● http://www.simple-talk.com/dotnet/.net-framework/xpath,-css,-dom-and-selenium-the-rosetta-stone/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
  • 14. 14Blogs and Web Sites● SeleniumSimplified.com● EvilTester.com● Testing Papers and Tools– CompendiumDev.co.ukTwitter: @eviltesterOnline Training Courses● Technical Web Testing 101– Unow.be/at/udemy101● Intro to Selenium– Unow.be/at/udemystart● Selenium 2 WebDriver API– Unow.be/at/udemyapiVideosyoutube.com/user/EviltesterVideosBooksSelenium SimplifiedUnow.be/rc/selsimpAlan Richardson is an Independent TestConsultant based in the UK. He offers trainingand consultancy in Selenium WebDriver,exploratory and technical web testing.– uk.linkedin.com/in/eviltesterContact Alan for training andconsultancy tailored to your needs:alan@compendiumdev.co.uk