Selenium 2 - PyCon 2011

10,039 views
9,275 views

Published on

Jason Huggins presents Selenium 2 at PyCon 2011 in Atlanta on 12 March 2011

Published in: Technology
5 Comments
19 Likes
Statistics
Notes
No Downloads
Views
Total views
10,039
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
429
Comments
5
Likes
19
Embeds 0
No embeds

No notes for slide

Selenium 2 - PyCon 2011

  1. Selenium 2 Jason HugginsCo-creator, The Selenium ProjectCo-founder, CTO, Sauce Labs Inc twitter: @hugs email: hugs@saucelabs.com
  2. Follow me on Twitter:@hugs
  3. Get Library from PyPI$ pip install -U selenium
  4. Agenda• Overview of Selenium • Selenium IDE, Builder (new!), RC, Grid• Why: Selenium 2• What: Selenium 2• Demos!
  5. What is Selenium? = +
  6. The Problem
  7. Selenium IDE for Firefox
  8. Builder (new!)
  9. !"#$%"&$(%)$* 9 +%%,-..///01*234)03$#.,+$%$5.23"6$(".789:;8<=:
  10. Selenium Remote Control Selenium RC Server Python, Ruby, Your AwesomeJava, C#, or Perl HTTP HTTP HTTP Web App Test Script
  11. Example Selenium RC Test - Java
  12. Example Selenium RC Test - C#
  13. !"#$Selenium Grid %&&())***+,-#./"+.01)%0&02)$345)678
  14. Servers Time Unit of Work
  15. Servers Time Unit of Work
  16. Selenium 2: Why and What
  17. Mobile
  18. Types of Mobile Testing• Emulator• Real device (tethered to workstation)• Real device in a real location on a real network
  19. Native vs Web
  20. Life before the WebTotal Application Market
  21. Yesterday JS+HTMLTotal Application Market
  22. Today JS+HTML5Total Application Market
  23. Data?
  24. Sencha
  25. SproutCore
  26. PhoneGap
  27. Today Selenium lives here! JS+HTML5Total Application Market
  28. Today Selenium lives here! JS+HTML5Total Application Market
  29. Tomorrow Selenium lives here! JS+HTML5Total Application Market
  30. The Pareto Principle
  31. AKA (“The Pacman Problem”) Selenium 1 Selenium 2
  32. Solving the last 20%• Native keyboard & mouse events• Same Origin Policy / XSS / HTTP(S)• Pop-ups, dialogs – Basic Authentication – Self-signed certi cates – File upload/download
  33. Cleaner API• WebDriver Object• WebElement Objects
  34. Other Bene ts• Improved architecture• Removing road-blocks, hacks, and workarounds• Scales down (more developer friendly) experience
  35. Selenium Remote Control Selenium RC Server Python, Ruby, Your AwesomeJava, C#, or Perl HTTP HTTP HTTP Web App Test Script
  36. Selenium 2 Selenium RC Server Python, Ruby, Your AwesomeJava, C#, or Perl HTTP HTTP HTTP Web App Test Script
  37. Python, Ruby, Your AwesomeJava, C#, or Perl HTTP HTTP Web App Test Script
  38. Python, Ruby, Your AwesomeJava, C#, or Perl C/C++ HTTP Web App Test Script
  39. Running a server is now optional! Selenium Grid Python, Ruby, Your AwesomeJava, C#, or Perl HTTP HTTP HTTP Web App Test Script
  40. Mobile - How?
  41. Checkout Selenium
  42. Android
  43. Download Android SDK
  44. Unpack~/android_sdk
  45. Update$ cd ~/android_sdk/tools$ ./android update sdk
  46. Create AVD$ ./android create avd -n my_android -t 8 -c 100M
  47. Start Emulator$ ./emulator -avd my_android -no-audio -no-boot-anim -scale .8 &
  48. Install Selenium APK$ cd ~/android_sdk/platform-tools/$ ./adb -e install -r ~/selenium/android/prebuilt/android-server.apk
  49. Port Forwarding$ ./adb forward tcp:8080 tcp:8080
  50. (One More Step) Launch WebDriver App
  51. iPhone
  52. Open in XCode$ open ~/selenium/iphone/iWebDriver.xcodeproj/
  53. Build & Run
  54. Demo!
  55. The Code:# Import the Selenium 2 namespace (aka "webdriver")from selenium import webdriver# Run one of the four following commands:# iPhonedriver = webdriver.Remote(browser_name="iphone", command_executor=http://172.24.101.36:3001/hub)# Androiddriver = webdriver.Remote(browser_name="android", command_executor=http://127.0.0.1:8080/hub)# Google Chromedriver = webdriver.Chrome()# Firefoxdriver = webdriver.Firefox()
  56. The Code:# The actual test scenario: Test the codepad.org code execution service.# Go to codepad.orgdriver.get(http://codepad.org)# Select the Python language optionpython_link = driver.find_elements_by_xpath("//input[@name=lang and @value=Python]")[0]python_link.click()# Enter some text!text_area = driver.find_element_by_id(textarea)text_area.send_keys("print Hello, + World!")# Submit the form!submit_button = driver.find_element_by_name(submit)submit_button.click()# Make this an actual test. Isnt Python beautiful?assert "Hello, World!" in driver.get_page_source()# Close the browser!driver.quit()
  57. Selenium 2 - The Movie
  58. LinksFor More Information:✓http://seleniumhq.org✓http://code.google.com/p/selenium✓http://code.google.com/p/se-builder/✓http://saucelabs.com/docs/selenium2✓http://twitter.com/hugsSlides:✓http://www.slideshare.net/hugs/se2pyconCode:✓http://gist.github.com/830011
  59. Thanks! Jason HugginsCo-creator, The Selenium ProjectCo-founder, CTO, Sauce Labs Inc twitter: @hugs email: hugs@saucelabs.com

×