Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mateusz Radkiewicz - "Automate user's actions with Selenium, Auto it and Sikuli"

576 views

Published on

Presentation from lecture at "Trójmiejska Grupa Testerska". Event that connect testers in Poland (3city).

Published in: Software
  • Be the first to comment

Mateusz Radkiewicz - "Automate user's actions with Selenium, Auto it and Sikuli"

  1. 1. 1 Automate user’s actions with Selenium, AutoIT and Sikuli Mateusz Radkiewicz
  2. 2. Let’s automate simple web application! • Selenium WebDriver What about more complex actions? • Selenium Actions, Javascript Executor Need to interact with OS interface? • Java.awt.Robot Come to grips with MS Windows. • AutoIT Sky is the limit! • Sikuli Agenda 2
  3. 3. Selenium WebDriver Basic Selenium WebDriver interactions: • Open a web page • Hit „back” and „forward” buttons • Refresh a page • Get current URL • Delete or add a cookie • Get the source of a page • Switch to another tab/window • Close the tab • Click a link, button, checkbox, radiobutton, image • Enter text into textfield, textarea • Get text from a label • Get web page element’s attributes • Check if element is displayed • Get element’s location on the screen 3 Control a browser Interact with a page
  4. 4. Selenium WebDriver Let’s automate simple web application! 4
  5. 5. Selenium WebDriver Amazon.com – simple test case Objectives: • Go to amazon.com • Search for „octocopter” • Get number of search results 5
  6. 6. Selenium WebDriver Demo 6
  7. 7. Selenium WebDriver What about more complex actions? 7
  8. 8. Selenium WebDriver Selenium Actions Simulate more advanced actions using mouse and keyboard: • Click right mouse button • Double click • Move mouse over element • Drag and drop • Press combination of keys • Hold Ctrl key and click elements on the list 8
  9. 9. Selenium WebDriver Selenium Actions - example Objectives: • Select „Ford” and „Porsche” • Move them to the right container 9
  10. 10. Resize text area by modifying „rows” attribute Scroll the page left by 20 pixels Enter text with JavaScript Enable the button Selenium WebDriver Javascript Executor – a little bit of magic A simple way to execute JavaScript code directly from Selenium test 10
  11. 11. Java.awt.Robot Need to interact with OS interface? Robot lets you press the keys and click on the coordinates on a screen. 11
  12. 12. Java.awt.Robot Robot - example Objectives: • Open TED.com page • Press Ctrl+F to enable search • Search for „gems” word 12
  13. 13. AutoIT Come to grips with MS Windows 13
  14. 14. AutoIT Features • Simple scripting language for automating Windows GUI • Interacts with all standard windows controls • Simulates keyboard and mouse actions • Suitable for general scripting and creating simple applications • Scripts can be compiled into standalone *.exe • Easy to learn • Freeware 14
  15. 15. AutoIT File upload with Selenium and AutoIT - example Objectives: • Go to „https://careers.kainos.com/members/” • Click „Upload a CV …” button • Enter a path to local file and click „Open” 15
  16. 16. AutoIT Step 1: Inspect the window Use „AutoIT Window Info” tool to identify the window, field and button. 16
  17. 17. AutoIT Step 2: Write the script in „SciTE” editor 17
  18. 18. AutoIT Step 3: Compile the code 18 Step 4: Include AutoIT *.exe into Selenium test • Open „SciTE” menu Tools > Compile • Enter location of output *.exe file • Click „Compile Script”
  19. 19. AutoIT Demo 19
  20. 20. Sikuli Sky is the limit! 20
  21. 21. Sikuli Features • Lets you automate anything that is displayed on the screen • Uses image recognition algorithms to identify GUI components • Can reach anything that’s out of range for other tools • No need to have access to application’s structure • Cross-platform • Freeware • Provides own IDE (Jython) • Provides libraries for development in Java • Extremely easy to create automatic test, problematic to maintain it 21
  22. 22. Sikuli File download with Selenium and Sikuli - example Objectives: • Go to „https://code.google.com/p/altdrag” • Click „Download installer” • Click „Save File” button • Click „Save” button in the next window • Press Win+D to minimize all windows • Verify downloaded on the desktop • Delete above file 22
  23. 23. Sikuli Step 1: Download and install Sikuli • http://www.sikuli.org 23 Step 2: Include Sikuli in your project • Add „sikuli-java.jar” library in your IDE Step 3: Create screenshots
  24. 24. Sikuli Step 4: Write the script 24
  25. 25. Sikuli Demo 25
  26. 26. Sikuli Sikuli IDE 26
  27. 27. Sikuli Matching Preview 27
  28. 28. Sikuli Let’s rock! Objectives: • Run the script on Windows • Switch to Ubuntu on VMware • Open Firefox • Navigate to Rio de Janeiro on Google Maps • Collapse side panel • Enable Google Street View on Astoria Palace • Look around Copacapana until you find a girl on a bicycle • Zoom into the girl 28
  29. 29. Sikuli Sikuli IDE - demo 29
  30. 30. 30
  31. 31. 31

×