Automating Your Browser and Desktop Apps (with InventWithPython.com bit.ly/automatetalk.

Slides:



Advertisements
Similar presentations
Microsoft Expression Web-Illustrated Unit K: Working with Behaviors.
Advertisements

Introduction to Web Design Lecture number:. Todays Aim: Introduction to Web-designing and how its done. Modelling websites in HTML.
How to Log on & Log off of a Laptop and why it’s important.
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
CS7026 jQuery Events. What are Events?  jQuery is tailor-made to respond to events in an HTML page.  Events are actions that can be detected by your.
The Windows 7 Desktop you are familiar with is still here with a few differences. This is still where you find the most common apps like Word, Internet.
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
Chapter 5 Creating an Image Map
Installing Citrix Receiver
COMPREHENSIVE Windows Tutorial 3 Personalizing Your Windows Environment.
WALK-AND-TALK LIGHTNING INTERACTIVE WHITEBOARD AISHA ARSHAD, MEDIA SPECIALIST BRADENTON PREPARATORY ACADEMY, DUBAI SPORTS CITY Quick Start Guide.
Introduction to HTML Lists, Images, and Links. Before We Begin Save another file in Notepad Save another file in Notepad Open your HTML, then do File>Save.
Click your mouse for next slide Dreamweaver – Merging, Coloring, Fonts Now it’s time to fill your page with some more interesting stuff The first thing.
Retrieving compound pages This work is licensed under a Creative Commons Attribution-Noncommercial- Share Alike 3.0 License. Skills: none IT concepts:
Web Page Behavior IS 373—Web Standards Todd Will.
Intro to Microsoft Word.
1.Learning the Terms Learning the TermsLearning the Terms 2.Accessing the Internet from a PC Accessing the Internet from a PCAccessing the Internet from.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
HTML Tags. Objectives Know the commonly used HTML tags Create a simple webpage using the HTML tags that will be discussed.
Browser Comparisons - Convenience Internet Explorer 8 & 9, Chrome 11 and Firefox 4 Searching, Convenience & Add-ons.
Introduction to Computers I A presentation of the Elmhurst Public Library.
Lesson 15: Mobile Design and Layout Introduction to Adobe Dreamweaver CS6 Adobe Certified Associate: Web Communication using Adobe Dreamweaver CS6.
Raspberry Pi / Linux Workshop Ed Carr Marcus Summers.
Increase Your Computer Competency - Practical Tips and Tricks Cheryl Gould Summer 2005.
Dreamweaver CS4 Concepts and Techniques Chapter 7 Page Layout with Frames.
“Automate Anything You See” Uses image recognition to identify and control GUI components Useful when there is no easy access to a GUI's internal or source.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Inking. 2 Pen Basics You MUST keep your pen tethered at all times. If you lose the stylus, the replacement cost is $30. Buttons should face YOU in garage.
Web Page Design I Retest Terms Review. 1. Web pages are created using a language known as ___________. The coding of this language must follow specific.
EWD Web Applications EWD and Sencha Touch Dima Kassab & Luis Ibanez Distributed under the Creative Commons by Attribution 3.0 LicenseCreative Commons by.
Adding User Interactivity – Lesson 51 Adding User Interactivity Lesson 5.
Programming in HTML.  Programming Language  Used to design/create web pages  Hyper Text Markup Language  Markup Language  Series of Markup tags 

Lesson 12: Working with Code-editing Features Introduction to Adobe Dreamweaver CS6 Adobe Certified Associate: Web Communication using Adobe Dreamweaver.
Macromedia Dreamweaver 8-- Illustrated Introductory 1 Macromedia Dreamweaver 8 Unit E Using and Managing Images.
Templates and Style Sheets
Selenium IDE. Benefits Selenium IDE is full-featured Selenium version with GUI Easy to install (Firefox plugin) Plugin support Intelligent field selection.
Microsoft Expression Web-Illustrated Unit E: Working with Pictures.
1 HTML Forms
SAFARI ODBC INSTALLATION Go to the TRECA home WEB page.
Layers, Image Maps, and Navigation Bars
Web Development 101 Presented by John Valance
Submitting and Assignment Click on the assignment link in your course The folder with the paper sticking out of the top is the symbol for an assignment.
RLM System Actual Cut Entry. Page 2 Glossary of Training Terms The following terms will be used throughout this training program: –Field: A box on the.
Copyright 2007, Paradigm Publishing Inc. EXCEL 2007 Chapter 8 BACKNEXTEND 8-1 LINKS TO OBJECTIVES Save a Workbook as a Web Page Save a Workbook as a Web.
Lec 19 Web Driver 1 CSCE 747 Fall 2013 CSCE 747 Software Testing and Quality Assurance Lecture 19 Selenium Web Driver 11/4/
Photoshop Image Slicing. Reasons to Image Slide To create links out of sliced images To optimise different areas. (flat areas of colour, such as logos,
January 2006Colby College ITS Setting Up Course Pages.
The Basics of Managing Your Department Website March 8, 2012.
1 Applets. 2 What is an applet? Applet: a Java program that can be inserted into a web page and run by loading that page in a browser brings web pages.
Know your computer Make a Folder Copy from Word to Composer Format the Font Change the Alignment Format the Background Format the Colors Insert a Picture.
Rhapsody Adendum. Remote Access Start VPN through connect.spsu.edu Select ‘Client Apps’ on the toolbar on the right top of page Then click ‘Start’ on.
20-753: Fundamentals of Web Programming 1 Lecture 6: Advanced HTML Fundamentals of Web Programming Lecture 6: Advanced HTML.
Creating and Editing a Web Page Using Inline Styles
What’s on Your Desktop?. Programs on your computer Some programs are standard on most computers for example: Microsoft Word Internet Explorer Microsoft.
Web Scraping with Python and Selenium. What is Web Scraping?  Software technique for extracting info from websites Get information programmatically that.
Explore GNOME The easy way, using a live CD By Carl Weisheit.
Tata Consultancy Services1 WebDriver Basics Submitted By : Akhil K Gagan Deep Singh Naveenrajha H M Poornachandra Meduri Shubham Utsav Sunil Kumar G Vivek.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Installing Citrix Receiver
Welcome to the [Course Name] course.
Test Automation For Web-Based Applications
Python, PhantomJS, & Selenium
Tutorial 6 Creating Dynamic Pages
Test Automation For Web-Based Applications
Intro to Web Development Nesting Elements
University of Warith AL-Anbiya’a
Retrieving compound pages
User guide for OneDrive
Presentation transcript:

Automating Your Browser and Desktop Apps (with InventWithPython.com bit.ly/automatetalk

Hi, I’m Al. I liek programming. I wrote a programming book. Creative Commons license. AutomateTheBoringStuff.com

Web Scraping DID YOU KNOW? –The web has interesting stuff on it.

Not Found The requested URL was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Selenium pip install selenium

Selenium >>> from selenium import webdriver >>> browser = webdriver.Firefox() >>> browser.get(' >>> elem = browser.find_element_by_css_selector('.entry-content > ol:nth-child(15) > li:nth-child(1) > a:nth-child(1)') >>> elem.click() >>> browser.quit()

Selenium >>> from selenium import webdriver >>> browser = webdriver.Firefox() >>> browser.get(' >>> elem = browser.find_element_by_css_selector('.entry-content > ol:nth-child(15) > li:nth-child(1) > a:nth-child(1)') >>> elem.click() >>> browser.quit()

Selenium >>> from selenium import webdriver >>> browser = webdriver.Firefox() >>> browser.get(' >>> elem = browser.find_element_by_css_selector('.entry-content > ol:nth-child(15) > li:nth-child(1) > a:nth-child(1)') >>> elem.click() >>> browser.quit()

Selenium >>> from selenium import webdriver >>> browser = webdriver.Firefox() >>> browser.get(' >>> elem = browser.find_element_by_css_selector('.entry-content > ol:nth-child(15) > li:nth-child(1) > a:nth-child(1)') >>> elem.click() >>> browser.quit()

Selenium >>> from selenium import webdriver >>> browser = webdriver.Firefox() >>> browser.get(' >>> elem = browser.find_element_by_css_selector('.entry-content > ol:nth-child(15) > li:nth-child(1) > a:nth-child(1)') >>> elem.click() >>> browser.quit()

Selenium >>> from selenium import webdriver >>> browser = webdriver.Firefox() >>> browser.get(' >>> elem = browser.find_element_by_css_selector('.entry-content > ol:nth-child(15) > li:nth-child(1) > a:nth-child(1)') >>> elem.click() >>> browser.quit()

Selenium >>> from selenium import webdriver >>> browser = webdriver.Firefox() >>> browser.get(' >>> elem = browser.find_element_by_css_selector('.entry-content > ol:nth-child(15) > li:nth-child(1) > a:nth-child(1)') >>> elem.click() >>> browser.quit()

CSS Selector Syntax browser.find_element_by_css_selector( '.entry-content > ol:nth-child(15) > li:nth-child(1) > a:nth-child(1)') Returns an element object. (Also: find_elements_by_css_selector() which returns a list of element objects.)

Clicking and Typing Element object methods: –click() –send_keys() –submit()

Clicking and Typing Special key values (up arrow, F1, Ctrl, etc.)

Clicking and Typing “Flat is better than nested.” from selenium.webdriver.common.keys import Keys

Misc Browser Stuff browser.back() browser.forward() browser.refresh()

Reading Data from the Web Page elem.text elem.get_attribute('href') To get ALL attributes: – elem.get_attributes()

Reading Data from the Web Page elem.text elem.get_attribute('href') To get ALL attributes: – elem.get_attributes() – elem.get_attribute('outerHTML') – ' '

GUI Automation Control the mouse and keyboard.

Installing PyAutoGUI pip install pyautogui –Works on Python 2 & 3 –Works on Windows, Mac, & Linux –Simple API rg

Mouse Control click() click([x, y]) doubleClick() rightClick() moveTo(x, y [, duration=seconds]) moveRel(x_offset, y_offset [, duration=seconds]) dragTo(x, y [, duration=seconds]) position()(returns (x, y) tuple) size()(returns (width, height) tuple) displayMousePosition()

Keyboard Control typewrite('Text goes here.' [, interval=secs]) press('pageup') pyautogui.KEYBOARD_KEYS hotkey('ctrl', 'o')

Spiral Drawing Live Demo TEMPT THE GODS ONCE MORE.

WARNING

Failsafe Move the mouse to the top-left corner of the screen to raise the FailSafeException. pyautogui.PAUSE is set to 0.1, adding a tenth-second delay after each call.

Image Recognition Linux: sudo apt-get scrot pixel(x, y) –returns RGB tuple screenshot([filename]) –returns PIL/Pillow Image object [and saves to file] locateOnScreen(imageFilename) –returns (left, top, width, height) tuple or None

What is GUI automation used for? Automating tests for non- browser apps. Automating non-HTML parts of browser apps. Cheating at Flash games.

THE GOAL: Cheating at Flash Games LIVE DEMO, BABY

Thanks! bit.ly/automatetalk pip install selenium pip install pyautogui