100% found this document useful (4 votes)
44 views71 pages

Selenium WebDriver Recipes in Python The Problem Solving Guide To Selenium WebDriver in Python 1st Edition Zhimin Zhan PDF Download

The document provides a comprehensive guide to Selenium WebDriver in Python, detailing various recipes and best practices for automating web testing. It includes sections on locating web elements, hyperlink interactions, and button functionalities, among others. The book is available for purchase and offers additional resources for readers looking to enhance their Selenium skills.

Uploaded by

xcnwybs9232
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
44 views71 pages

Selenium WebDriver Recipes in Python The Problem Solving Guide To Selenium WebDriver in Python 1st Edition Zhimin Zhan PDF Download

The document provides a comprehensive guide to Selenium WebDriver in Python, detailing various recipes and best practices for automating web testing. It includes sections on locating web elements, hyperlink interactions, and button functionalities, among others. The book is available for purchase and offers additional resources for readers looking to enhance their Selenium skills.

Uploaded by

xcnwybs9232
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 71

Selenium WebDriver Recipes in Python The problem

solving guide to Selenium WebDriver in Python


1st Edition Zhimin Zhan download

https://ebookname.com/product/selenium-webdriver-recipes-in-
python-the-problem-solving-guide-to-selenium-webdriver-in-
python-1st-edition-zhimin-zhan/

Get the full ebook with Bonus Features for a Better Reading Experience on ebookname.com
Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Selenium design patterns and best practices build a


powerful stable and automated test suite using Selenium
WebDriver Kovalenko

https://ebookname.com/product/selenium-design-patterns-and-best-
practices-build-a-powerful-stable-and-automated-test-suite-using-
selenium-webdriver-kovalenko/

Problem Solving with Algorithms and Data Structures


Using Python SECOND EDITION Bradley N. Miller

https://ebookname.com/product/problem-solving-with-algorithms-
and-data-structures-using-python-second-edition-bradley-n-miller/

Programming in Python 3 A Complete Introduction to the


Python Language 2nd Edition Summerfield

https://ebookname.com/product/programming-in-python-3-a-complete-
introduction-to-the-python-language-2nd-edition-summerfield/

Essentials of Online payment Security and Fraud


Prevention Essentials Series 1st Edition David A.
Montague

https://ebookname.com/product/essentials-of-online-payment-
security-and-fraud-prevention-essentials-series-1st-edition-
david-a-montague/
Recessions Prospects and Developments Prospects and
Developments 1st Edition Nerea M. Pérez

https://ebookname.com/product/recessions-prospects-and-
developments-prospects-and-developments-1st-edition-nerea-m-
perez/

The Last Sorcerers The Path From Alchemy To The


Periodic Table 1st Edition Morris Richard

https://ebookname.com/product/the-last-sorcerers-the-path-from-
alchemy-to-the-periodic-table-1st-edition-morris-richard/

Essentials of Stem Cell Biology 1st Edition R Lanza

https://ebookname.com/product/essentials-of-stem-cell-
biology-1st-edition-r-lanza/

Nanomedicine and the Cardiovascular System 1st Edition


Ross J. Hunter (Editor)

https://ebookname.com/product/nanomedicine-and-the-
cardiovascular-system-1st-edition-ross-j-hunter-editor/

The New Physics for the Twenty First Century 2Rev Ed


Edition Gordon Fraser

https://ebookname.com/product/the-new-physics-for-the-twenty-
first-century-2rev-ed-edition-gordon-fraser/
Microtexture Determination and Its Applications 2nd
Edition Valerie Randle

https://ebookname.com/product/microtexture-determination-and-its-
applications-2nd-edition-valerie-randle/
Selenium WebDriver Recipes in Python
The problem solving guide to Selenium WebDriver in
Python

Zhimin Zhan
This book is for sale at http://leanpub.com/selenium-recipes-in-python

This version was published on 2020-06-12

This is a Leanpub book. Leanpub empowers authors and publishers with the Lean
Publishing process. Lean Publishing is the act of publishing an in-progress ebook using
lightweight tools and many iterations to get reader feedback, pivot until you have the right
book and build traction once you do.

© 2015 - 2020 Zhimin Zhan


Also By Zhimin Zhan
Practical Web Test Automation
Watir Recipes
Selenium WebDriver Recipes in Ruby
Selenium WebDriver Recipes in Java
Learn Ruby Programming by Examples
Learn Swift Programming by Examples
API Testing Recipes in Ruby
Selenium WebDriver Recipes in Node.js
Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i
Who should read this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
How to read this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
Recipe test scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
Send me feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii

1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Selenium language bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Install Selenium Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Cross browser testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 unittest - Python Unit Testing Framework . . . . . . . . . . . . . . . . . . . 8
1.5 Run recipe scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2. Locating web elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14


2.1 Start browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2 Find element by ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3 Find element by Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4 Find element by Link Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.5 Find element by Partial Link Text . . . . . . . . . . . . . . . . . . . . . . . . 16
2.6 Find element by XPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.7 Find element by Tag Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.8 Find element by Class Name . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.9 Find element by CSS Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.10 Chain find_element to find child elements . . . . . . . . . . . . . . . . . . . 18
2.11 Find multiple elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

3. Hyperlink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.1 Start browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.2 Click a link by text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
CONTENTS

3.3 Click a link by ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21


3.4 Click a link by partial text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.5 Click a link by XPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.6 Click Nth link with exact same label . . . . . . . . . . . . . . . . . . . . . . . 22
3.7 Click Nth link by CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.8 Verify a link present or not? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.9 Getting link data attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.10 Test links open a new browser window . . . . . . . . . . . . . . . . . . . . . 24

4. Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.1 Click a button by text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.2 Click a form button by text . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.3 Submit a form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.4 Click a button by ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.5 Click a button by name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.6 Click a image button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.7 Click a button via JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.8 Assert a button present . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.9 Assert a button enabled or disabled? . . . . . . . . . . . . . . . . . . . . . . . 28

5. TextField and TextArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29


5.1 Enter text into a text field by name . . . . . . . . . . . . . . . . . . . . . . . 29
5.2 Enter text into a text field by ID . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.3 Enter text into a password field . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.4 Clear a text field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.5 Enter text into a multi-line text area . . . . . . . . . . . . . . . . . . . . . . . 30
5.6 Assert value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.7 Focus on a control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.8 Set a value to a read-only or disabled text field . . . . . . . . . . . . . . . . . 31
5.9 Set and assert the value of a hidden field . . . . . . . . . . . . . . . . . . . . 31

6. Radio button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.1 Select a radio button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.2 Clear radio option selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.3 Assert a radio option is selected . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.4 Iterate radio buttons in a radio group . . . . . . . . . . . . . . . . . . . . . . 34
6.5 Click Nth radio button in a group . . . . . . . . . . . . . . . . . . . . . . . . 34
6.6 Click radio button by the following label . . . . . . . . . . . . . . . . . . . . 35
6.7 Customized Radio buttons - iCheck . . . . . . . . . . . . . . . . . . . . . . . 36
CONTENTS

7. CheckBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.1 Select by name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.2 Uncheck a checkbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.3 Assert a checkbox is checked (or not) . . . . . . . . . . . . . . . . . . . . . . 37
7.4 Customized Checkboxes - iCheck . . . . . . . . . . . . . . . . . . . . . . . . 38

8. Select List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
8.1 Select an option by text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
8.2 Select an option by value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
8.3 Select an option by index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
8.4 Select an option by iterating all options . . . . . . . . . . . . . . . . . . . . . 40
8.5 Select multiple options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
8.6 Clear one selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
8.7 Clear all selections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
8.8 Assert label or value in a select list . . . . . . . . . . . . . . . . . . . . . . . . 41
8.9 Assert selected option label . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
8.10 Assert the value of a select list . . . . . . . . . . . . . . . . . . . . . . . . . . 41
8.11 Assert multiple selections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

9. Navigation and Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43


9.1 Go to a URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
9.2 Visit pages within a site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
9.3 Perform actions from right mouse click context menu such as ‘Back’,
‘Forward’ or ‘Refresh’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
9.4 Open browser in certain size . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
9.5 Maximize browser window . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
9.6 Move browser window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
9.7 Minimize browser window . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
9.8 Scroll focus to control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
9.9 Switch between browser windows or tabs . . . . . . . . . . . . . . . . . . . 45
9.10 Open new and close browser Tabs . . . . . . . . . . . . . . . . . . . . . . . . 46
9.11 Remember current web page URL, then come back to it later . . . . . . . . 47

10. Assertion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
10.1 Assert page title . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
10.2 Assert Page Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
10.3 Assert Page Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
10.4 Assert Label Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
10.5 Assert Span text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
CONTENTS

10.6 Assert Div text or HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49


10.7 Assert Table text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
10.8 Assert text in a table cell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
10.9 Assert text in a table row . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
10.10 Assert image present . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
10.11 Assert element location and width . . . . . . . . . . . . . . . . . . . . . . . . 52
10.12 Assert element CSS style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
10.13 Assert JavaScript errors on a web page . . . . . . . . . . . . . . . . . . . . . 52

11. Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
11.1 Testing Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
11.2 Testing IFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
11.3 Test multiple iframes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

12. Testing AJAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56


12.1 Wait within a time frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
12.2 Explicit Waits until Time out . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
12.3 Implicit Waits until Time out . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
12.4 Create your own polling check function . . . . . . . . . . . . . . . . . . . . . 58
12.5 Wait AJAX Call to complete using JQuery . . . . . . . . . . . . . . . . . . . 58

13. File Upload and Popup dialogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60


13.1 File upload . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
13.2 JavaScript pop ups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
13.3 Modal style dialogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
13.4 Bypass basic authentication by embedding username and password in URL 63
13.5 Internet Explorer modal dialog . . . . . . . . . . . . . . . . . . . . . . . . . . 63
13.6 Popup Handler Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
13.7 Handle JavaScript dialog with Popup Handler . . . . . . . . . . . . . . . . . 65
13.8 Basic or Proxy Authentication Dialog . . . . . . . . . . . . . . . . . . . . . . 66

14. Debugging Test Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67


14.1 Print text for debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
14.2 Write page source or element HTML into a file . . . . . . . . . . . . . . . . 67
14.3 Take screenshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
14.4 Leave browser open after test finishes . . . . . . . . . . . . . . . . . . . . . . 68
14.5 Debug test execution using Debugger . . . . . . . . . . . . . . . . . . . . . . 69
14.6 Attach test executions to an existing browser . . . . . . . . . . . . . . . . . . 71
CONTENTS

15. Test Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73


15.1 Get date dynamically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
15.2 Get a random boolean value . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
15.3 Generate a number within a range . . . . . . . . . . . . . . . . . . . . . . . . 74
15.4 Get a random character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
15.5 Get a random string at fixed length . . . . . . . . . . . . . . . . . . . . . . . 75
15.6 Get a random string in a collection . . . . . . . . . . . . . . . . . . . . . . . 75
15.7 Generate random person names, emails, addresses with Faker . . . . . . . . 75
15.8 Generate a test file at fixed sizes . . . . . . . . . . . . . . . . . . . . . . . . . 76
15.9 Retrieve data from Database . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

16. Browser Profile and Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78


16.1 Get browser type and version . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
16.2 Set HTTP Proxy for Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
16.3 Verify file download in Chrome . . . . . . . . . . . . . . . . . . . . . . . . . 79
16.4 Test downloading PDF in Firefox . . . . . . . . . . . . . . . . . . . . . . . . . 79
16.5 Bypass basic authentication with Firefox AutoAuth plugin . . . . . . . . . . 80
16.6 Manage Cookies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
16.7 Headless browser testing with PhantomJS . . . . . . . . . . . . . . . . . . . 83
16.8 Headless Chrome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
16.9 Headless Firefox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
16.10 Test responsive websites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
16.11 Set page load timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
16.12 Device emulation on Chrome . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

17. Advanced User Interactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87


17.1 Double click a control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
17.2 Move mouse to a control - Mouse Over . . . . . . . . . . . . . . . . . . . . . 88
17.3 Click and hold - select multiple items . . . . . . . . . . . . . . . . . . . . . . 88
17.4 Context Click - right click a control . . . . . . . . . . . . . . . . . . . . . . . 88
17.5 Drag and drop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
17.6 Drag slider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
17.7 Send key sequences - Select All and Delete . . . . . . . . . . . . . . . . . . . 90
17.8 Click a specific part of an image . . . . . . . . . . . . . . . . . . . . . . . . . 91

18. HTML 5 and Dynamic Web Sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93


18.1 HTML5 Email type field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
18.2 HTML5 Time Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
18.3 Invoke ‘onclick’ JavaScript event . . . . . . . . . . . . . . . . . . . . . . . . . 94
CONTENTS

18.4 Invoke JavaScript events such as ‘onchange’ . . . . . . . . . . . . . . . . . . 95


18.5 Scroll to the bottom of a page . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
18.6 Select2 - Single Select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
18.7 Select2 - Multiple Select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
18.8 AngularJS web pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
18.9 Ember JS web pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
18.10 “Share Location” with Firefox . . . . . . . . . . . . . . . . . . . . . . . . . . 104
18.11 Faking Geolocation with JavaScript . . . . . . . . . . . . . . . . . . . . . . . 105
18.12 Save a canvas to PNG image . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
18.13 Verify dynamic charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

19. WYSIWYG HTML editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107


19.1 TinyMCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
19.2 CKEditor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
19.3 SummerNote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
19.4 CodeMirror . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

20. Leverage Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111


20.1 Raise exceptions to fail test . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
20.2 Ignorable test statement error . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
20.3 Read external file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
20.4 Data-Driven Tests with Excel . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
20.5 Data-Driven Tests with CSV . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
20.6 Identify element IDs with dynamically generated long prefixes . . . . . . . 115
20.7 Sending special keys such as Enter to an element or browser . . . . . . . . . 116
20.8 Use of unicode in test scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
20.9 Extract a group of dynamic data : verify search results in order . . . . . . . 116
20.10 Verify uniqueness of a set of data . . . . . . . . . . . . . . . . . . . . . . . . 117
20.11 Extract dynamic visible data rows from a results table . . . . . . . . . . . . 118
20.12 Extract dynamic text following a pattern using Regex . . . . . . . . . . . . . 120
20.13 Quick extract pattern text in comments with Regex . . . . . . . . . . . . . . 121

21. Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123


21.1 Assert page_source is faster than page text . . . . . . . . . . . . . . . . . . . 123
21.2 Getting text from specific element is faster . . . . . . . . . . . . . . . . . . . 124
21.3 Avoid programming if-else block if possible . . . . . . . . . . . . . . . . . . 124
21.4 Use variable to cache not-changed data . . . . . . . . . . . . . . . . . . . . . 124
21.5 Enter large text into a text box . . . . . . . . . . . . . . . . . . . . . . . . . . 125
21.6 Use Environment Variables to change test behaviours dynamically . . . . . 126
CONTENTS

21.7 Test web site in two languages . . . . . . . . . . . . . . . . . . . . . . . . . . 127


21.8 Multi-language testing with lookups . . . . . . . . . . . . . . . . . . . . . . . 128

22. Gotchas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131


22.1 Test starts browser but no execution with blank screen . . . . . . . . . . . . 131
22.2 Failed to assert copied text in browser . . . . . . . . . . . . . . . . . . . . . . 132
22.3 The same test works for Chrome, but not IE . . . . . . . . . . . . . . . . . . 133
22.4 “unexpected tag name ‘input’” . . . . . . . . . . . . . . . . . . . . . . . . . . 134
22.5 Element is not clickable or not visible . . . . . . . . . . . . . . . . . . . . . . 134

23. Material Design Web App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136


23.1 Select List (dropdown) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
23.2 Checkbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
23.3 Drag range (noUiSlider) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
23.4 Verify Toast message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
23.5 Modal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

24. Selenium Remote Control Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139


24.1 Selenium Server Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
24.2 Execute tests in specified browser on another machine . . . . . . . . . . . . 140
24.3 Selenium Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

Appendix - Continuous Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145


Verify server machine can run Selenium Python . . . . . . . . . . . . . . . . . . . . 145
Install BuildWise Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Create Build Project in BuildWise . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Trigger test execution manually . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Feedback while test execution in progress . . . . . . . . . . . . . . . . . . . . . . . . 149
Build finished . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Notification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

Afterword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Books . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Web Sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Preface
After observing many failed test automation attempts by using expensive commercial test
automation tools, I am delighted to see that the value of open-source testing frameworks has
finally been recognized. I still remember the day (a rainy day at a Gold Coast hotel in 2011)
when I found out that the Selenium WebDriver was the most wanted testing skill in terms
of the number of job ads on the Australia’s top job-seeking site.
Now Selenium WebDriver is big in the testing world. We all know software giants such
as Facebook and LinkedIn use it, immensely-comprehensive automated UI testing enables
them pushing out releases several times a day¹. However, from my observation, many
software projects, while using Selenium, are not getting much value from test automation,
and certainly nowhere near its potential. A clear sign of this is that the regression testing is
not conducted on a daily basis (if test automation is done well, it will happen naturally).
Among the factors contributing to test automation failures, a key one is that automation
testers lack sufficient knowledge in the test framework. It is quite common to see some
testers or developers get excited when they first create a few simple test cases and see them
run in a browser. However, it doesn’t take long for them to encounter some obstacles: such as
being unable to automate certain operations. If one step cannot be automated, the whole test
case does not work, which is the nature of test automation. Searching solutions online is not
always successful, and posting questions on forums and waiting can be frustrating (usually,
very few people seek professional help from test automation coaches). Not surprisingly,
many projects eventually gave up test automation or just used it for testing a handful of
scenarios.
The motivation of this book is to help motivated testers work better with Selenium. The book
contains over 190 recipes for web application tests with Selenium. If you have read one of
my other books: Practical Web Test Automation², you probably know my style: practical. I
will let the test scripts do most of the talking. These recipe test scripts are ‘live’, as I have
created the target test site and included offline test web pages. With both, you can:

1. Identify your issue


2. Find the recipe
¹http://www.wired.com/business/2013/04/linkedin-software-revolution/
²https://leanpub.com/practical-web-test-automation
Preface ii

3. Run the test case


4. See test execution in your browser

Who should read this book


This book is for testers or programmers who are writing (or want to learn) automated tests
with Selenium WebDriver. In order to get the most of this book, basic Ruby coding skill is
required.

How to read this book

Usually, a ‘recipe’ book is a reference book. Readers can go directly to the part that interests
them. For example, if you are testing a multiple select list and don’t know how, you can look
up in the Table of Contents, then go to the chapter 8. This book supports this style of reading.
If you are new to Selenium WebDriver, I recommend you to try out the recipes from the
front to back. The recipes in the first half of the book are arranged according to their levels of
complexity, I believe readers can get the pattern of testing with Selenium and gain confidence
after going through them.

Recipe test scripts


To help readers to learn more effectively, this book has a dedicated site³ that contains the
recipe test scripts, test web pages and related resources. For access code, please see the
Resources section of this book.
As an old saying goes, “There’s more than one way to skin a cat.” You can achieve the same
testing outcome with test scripts implemented in different ways. The recipe test scripts in
this book are written for simplicity, and there is always room for improvement. But for many,
to understand the solution quickly and get the job done are probably more important.
If you have a better and simpler way, please let me know.
All recipe test scripts are Selenium WebDriver 3 compliant, and can be run against Chrome,
Firefox and Internet Explorer on multiple platforms. I plan to keep the test scripts updated
with the latest stable Selenium version.
³http://zhimin.com/books/selenium-recipes-nodejs
Preface iii

Send me feedback
I would appreciate your comments, suggestions, reports on errors in the book and the recipe
test scripts. You may submit your feedback on the book’s site.

Zhimin Zhan
Brisbane, Australia
1. Introduction
Selenium is a free and open source library for automated testing web applications. Selenium
was originally created in 2004 by Jason Huggins, it merged with another test framework
WebDriver in 2011 (that’s why is named ‘selenium-webdriver’) led by Simon Stewart at
Google (update: Simon now works at FaceBook). As WebDriver is a W3C standard¹, it gains
support from all major browser vendors, as a result, Selenium WebDriver quickly become
the de facto framework for automated testing web applications.

1.1 Selenium language bindings


Selenium tests can be written in multiple programming languages such as Java, C#, Python,
JavaScript and Ruby (the core ones). Quite commonly, I heard the saying such as “This is a
Java project, so we shall write tests in Java as well”. I disagree. Software testing is to verify
whether programmer’s work meets customer’s needs. In a sense, testers are representing
customers. Testers should have more weight on deciding the test syntax than programmers.
Plus, why would you mandate that your testers should have the same programming language
skills as the programmers. In my subjective view, scripting languages such as Ruby and
Python are more suitable for test scripts than compiled languages such as C# and Java
(Confession: I have been programming in Java for over 10 years). By the way, we call them
test scripts, for a reason.
All examples in this book are written in Selenium with Python binding. This does not mean
this book is limited to testers/developers who know Python. As you will see the examples
below, the use of Selenium in different bindings are very similar. Once you master one, you
can apply it to others quite easily. Take a look at a simple Selenium test script in five different
language bindings: Java, C#, JavaScript, Ruby and Python.
Java:

¹https://www.w3.org/TR/webdriver/
Introduction 2

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class GoogleSearch {


public static void main(String[] args) {
// Create a new instance of the html unit driver
// Notice that the remainder of the code relies on the interface,
// not the implementation.
WebDriver driver = new FirefoxDriver();

// And now use this to visit Google


driver.get("http://www.google.com");

// Find the text input element by its name


WebElement element = driver.findElement(By.name("q"));

// Enter something to search for


element.sendKeys("Hello Selenium WebDriver!");

// Submit the form based on an element in the form


element.submit();

// Check the title of the page


System.out.println("Page title is: " + driver.getTitle());
}
}

C#:

using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;

class GoogleSearch
{
static void Main()
{
IWebDriver driver = new FirefoxDriver();
driver.Navigate().GoToUrl("http://www.google.com");
IWebElement query = driver.FindElement(By.Name("q"));
query.SendKeys("Hello Selenium WebDriver!");
Introduction 3

query.Submit();
Console.WriteLine(driver.Title);
}
}

JavaScript:

var webdriver = require('selenium-webdriver');


var driver = new webdriver.Builder()
.forBrowser('chrome')
.build();

driver.get('http://www.google.com/ncr');
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');
driver.findElement(webdriver.By.name('btnG')).click();
driver.wait(webdriver.until.titleIs('webdriver - Google Search'), 1000);
console.log(driver.title);

Ruby:

require "selenium-webdriver"

driver = Selenium::WebDriver.for :firefox


driver.navigate.to "http://www.google.com"

element = driver.find_element(:name, 'q')


element.send_keys "Hello Selenium WebDriver!"
element.submit

puts driver.title

Python:

from selenium import webdriver

driver = webdriver.Firefox()
driver.get("http://www.google.com")

elem = driver.find_element_by_name("q")
elem.send_keys("Hello WebDriver!")
elem.submit()

print(driver.title)
Introduction 4

1.2 Install Selenium Python


1. Download and install Python.
Python 2 is pre-installed on Mac and most Linux distributions. For new Python
projects, I would recommend Python 3, which was first released in 2008. Here are
the instructions to install Python on Windows.
Download latest installer² and run the installer.

Accept all default options except “Add python.exe to Path” for convenience.
For Mac,
brew install python3

2. Install Selenium-WebDriver for Python.


PIP is the package manager for Python. PIP comes with Python installer, run the
command below to upgrade to the latest PIP version.
> python -m pip install --upgrade pip

Install Selenium-WebDriver for Python.

²https://www.python.org/downloads
Introduction 5

C:\Users\Administrator>pip3 install selenium


Collecting selenium
Downloading selenium-3.141.0-py2.py3-none-any.whl (904kB)
100% |################################| 911kB 525kB/s
Installing collected packages: selenium
Collecting urllib3 (from selenium)
Downloading urllib3-1.24-py2.py3-none-any.whl (117kB)
Successfully installed selenium-3.141.0 urllib3-1.24

3. Your target browses are installed, such as Chrome and Firefox.

Now you are ready to run Selenium script. Type in the above python script (google search)
in a text editor such as NotePad and save as “google_search.py”. Run the command below
in a command window.

> py google_search.py

You will see Firefox browser starting up and performing a Google search.

1.3 Cross browser testing


The biggest advantage of Selenium over other web test frameworks, in my opinion, is
that it supports all major web browsers: Firefox, Chrome and Internet Explorer/Edge. The
browser market nowadays is more diversified (based on the StatsCounter³, the usage share
in December 2017 for Chrome, IE/Edge and Firefox are 64.7%, 12.2% and 11.9% respectively).
It is logical that all external facing web sites require serious cross-browser testing. Selenium
is a natural choice for this purpose, as it far exceeds other commercial tools and free test
frameworks..

Chrome

To run Selenium tests in Google Chrome, besides the Chrome browser itself, ChromeDriver
needs to be installed.
Installing ChromeDriver is easy: go to ChromeDriver site⁴.
³http://en.wikipedia.org/wiki/Usage_share_of_web_browsers
⁴https://sites.google.com/a/chromium.org/chromedriver/downloads
Introduction 6

Download the one for your target platform, unzip it and put chromedriver executable in
your PATH. To verify the installation, open a command window (terminal for Unix/Mac),
execute command chromedriver, You shall see:
Starting ChromeDriver 80.0.3987.16 (....) on port 9515
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent
access by malicious code.

The test script below opens a site in a new Chrome browser window and closes it one second
later.
from selenium import webdriver
import time

driver = webdriver.Chrome()
driver.get("http://testwisely.com/demo")
time.sleep(1) # wait 1 second
driver.quit()

For readers who can’t wait to see the test running, below is the command you need to use to
execute a test, which you can download from the book’s site (Python and selenium library
need to be installed first. See instructions towards the end of this chapter).
> python ch01_open_chrome.py

Firefox
Selenium tests requires Gecko Driver⁵ to drive Firefox. The test script below will open a web
site in a new Firefox window.
⁵https://github.com/mozilla/geckodriver/releases/
Introduction 7

from selenium import webdriver


driver = webdriver.Firefox()
driver.get("http://testwisely.com/demo")

Internet Explorer

Selenium requires IEDriverServer to drive IE browser. Its installation process is very similar
to ChromeDriver. IEDriverServer is available at https://www.selenium.dev/downloads⁶.
Choose the right one based on your windows version (32 or 64 bit).

When a tests starts to execute in IE, before navigating the target test site, you will see this
first:

Depending on the version of IE, configurations may be required. Please see IE and IEDri-
verServer Runtime Configuration⁷ for details.

from selenium import webdriver


driver = webdriver.Ie()
driver.get("http://testwisely.com/demo")

Edge

Edge is Microsoft’s new and default web browser on Windows 10. To drive Edge with
WebDriver, you need download Microsoft WebDriver⁸. After installation, you will find the
executable (MicrosoftWebDriver.exe) under Program Files folder, add it to your PATH.
However, I couldn’t get it working after installing a new version of Microsoft WebDriver.
One workaround is to specify the driver path in test scripts specifically:

⁶https://www.selenium.dev/downloads
⁷https://code.google.com/p/selenium/wiki/InternetExplorerDriver#Required_Configuration
⁸https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Introduction 8

from selenium import webdriver


import time
import os

# copy MicrosoftWebDriver.exe to the test script directory


dir = os.path.dirname(__file__)
edge_path = dir + "\MicrosoftWebDriver.exe"
driver = webdriver.Edge(edge_path)
driver.get("http://testwisely.com/demo")

1.4 unittest - Python Unit Testing Framework


The above scripts drive browsers, strictly speaking, they are not tests. To make the effective
use of Selenium scripts for testing, we need to put them in a test syntax framework that
defines test structures and provides assertions (performing checks in test scripts). In this
book, I use unittest, also known as “PyUnit”, the unit testing framework for Python. Here is
an example.

import unittest
from selenium import webdriver

class FooBarTestCase(unittest.TestCase):

@classmethod
def setUpClass(cls):
cls.driver = webdriver.Chrome()

@classmethod
def tearDownClass(cls):
cls.driver.quit()

def setUp(self):
self.driver.get("http://travel.agileway.net")

def tearDown(self):
self.driver.find_element_by_link_text("Sign off").click()

def test_first_case(self):
self.assertEqual("Agile Travel", self.driver.title)
self.driver.find_element_by_name("username").send_keys("agileway")
# ...
Introduction 9

def test_second_case(self):
self.driver.find_element_by_id("register_link").click()
# ...
self.assertIn("Register", self.driver.find_element_by_tag_name("body").text)

The keywords class, setUpClass, setUp and def test_xxx define the structure of a test
script file.

• class FooBarTestCase(unittest.TestCase):
Test suite name for grouping related test cases.
• setUpClass() and tearDownClass().
Optional test statements run before and after all test cases, typically starting a new
browser window in setupClass and close it in tearDownClass.
• setUp() and tearDown().
Optional test statements run before and after each test case.
• def test_xxx(self):
Individual test cases.
• Assertions
assertEqual() and assertIn are PyUnit’s two assertion methods which are used to
perform checks. More assert methods⁹

You will find more about unittest from its home page¹⁰. However, I honestly don’t think it
is necessary. The parts used for test scripts are not much and quite intuitive. After studying
and trying out some examples, you will be quite comfortable with it.

1.5 Run recipe scripts


Test scripts for all recipes can be downloaded from the book site. They are all in ready-to-run
state. I include the target web pages/sites as well as Selenium test scripts. There are two kinds
of target web pages: local HTML files and web pages on a live site. Running tests written for
a live site requires Internet connection.
⁹https://docs.python.org/3/library/unittest.html#assert-methods
¹⁰https://docs.python.org/3/library/unittest.html
Introduction 10

Run tests in PyCharm IDE

The most convenient way to run one test case or a test suite is to do it in an IDE, such as
PyCharm.

When you have a large number of test cases, then the most effective way to run
all tests is done by a Continuous Integration process.

Find the test case

You can locate the recipe either by following the chapter or searching by name. There are
over 150 test cases in the recipes test project. Here is the quickest way to find the one you
want in PyCharm.
Select menu ‘Navigation’ → ‘Go to Symbol …’.

A pop up window lists all test cases in the project for your selection. The finding starts as
soon as you type.

Run individual test case

Move mouse to a line within a test case (starting def test_xxx)(self):). Right click and
select “Run ‘Unittest test_xxx’” to run this case.
Introduction 11

The below is a screenshot of execution panel when one test case failed,

Run all test cases in a test script file

You can also run all test cases in a test script file by right clicking the file name in the project
pane and select “Run ‘Unittests in test_file.py’”.
Introduction 12

The below is a screenshot of the execution panel when all test cases in a test script file passed,

Run tests from command line


One advantage of open-source test frameworks, such as Selenium, is FREEDOM. You can
edit the test scripts in any text editors and run them from a command line.
To run test cases in a test script file (named google_test.py), enter command
Introduction 13

> python -m unittest google_test.py

Run multiple test script files in one go:

> python -m unittest first_test.py second_test.py

The command syntax is identical for Mac OS X and Linux platforms.


2. Locating web elements
As you might have already figured out, to drive an element in a page, we need to find it first.
Selenium uses what is called locators to find and match the elements on web page. There are
8 locators in Selenium:
Locator Example
ID find_element_by_id("user")
Name find_element_by_name("username")
Link Text find_element_by_link_text("Login")
Partial Link Text find_element_by_partial_link_text("Next")
XPath find_element_by_xpath("//div[@id='login']/input")
Tag Name find_element_by_tag_name("body")
Class Name find_element_by_class_name("table")
CSS find_element_by_css_selector("#login > input[type='text']")

You may use any one of them to narrow down the element you are looking for.

2.1 Start browser


Testing websites starts with a browser. The test script below launches a Firefox browser
window and navigate to a site.

from selenium import webdriver


driver = webdriver.Chrome()
driver.get("http://testwisely.com/demo")

Use webdriver.Firefox and webdriver.Ie() for testing in Firefox and IE respectively.

Test Pages
I prepared the test pages for the recipes, you can download them (in a zip file) at the book’s
site. Unzip to a local directory and refer to test pages like this:
site_url = "file://" + os.path.dirname(os.path.realpath(__file__)) + "/../../site"
Locating web elements 15

driver.get(site_url + "/locators.html")

__file__ is the directory where the test script is.


http://zhimin.com/books/selenium-recipes-python

I recommend, for beginners, to close the browser window at the end of a test case.

driver.quit()

2.2 Find element by ID


Using IDs is the easiest and probably the safest way to locate an element in HTML. If a web
page is W3C HTML conformed¹, the IDs should be unique and identified in web controls
on the page. In comparison to texts, test scripts that use IDs are less prone to application
changes (e.g. developers may decide to change the label, but are less likely to change the ID).

driver.find_element_by_id("submit_btn").click() # Button
driver.find_element_by_id("cancel_link").click() # Link
driver.find_element_by_id("username").send_keys("agileway") # Textfield
driver.find_element_by_id("alert_div").text # HTML Div element

2.3 Find element by Name


The name attributes are used in form controls such as text fields and radio buttons. The
values of the name attributes are passed to the server when a form is submitted. In terms of
least likelihood of a change, the name attribute is probably only second to ID.

driver.find_element_by_name("comment").send_keys("Selenium Cool")

2.4 Find element by Link Text


For Hyperlinks only. Using a link’s text is probably the most direct way to click a link, as it
is what we see on the page.
¹http://www.w3.org/TR/WCAG20-TECHS/H93.html
Locating web elements 16

driver.find_element_by_link_text("Cancel").click()

2.5 Find element by Partial Link Text


Selenium allows you to identify a hyperlink control with a partial text. This can be quite
useful when the text is dynamically generated. In other words, the text on one web page
might be different on your next visit. We might be able to use the common text shared by
these dynamically generated link texts to identify them.

# will click the "Cancel" link


driver.find_element_by_partial_link_text("ance").click()

2.6 Find element by XPath


XPath, the XML Path Language, is a query language for selecting nodes from an XML
document. When a browser renders a web page, it parses it into a DOM tree or similar.
XPath can be used to refer a certain node in the DOM tree. If this sounds a little too much
technical for you, don’t worry, just remember XPath is the most powerful way to find a
specific web control.

# clicking the checkbox under 'div2' container


driver.find_element_by_xpath("//*[@id='div2']/input[@type='checkbox']").click()

Some testers feel intimidated by the complexity of XPath. However, in practice, there is only
limited scope of XPath to master for testers.
Locating web elements 17

Avoid using copied XPath from Browser’s Devel-


oper Tool
Browser’s Developer Tool (right click to select ‘Inspect element’ to show) is very
useful for identifying a web element in web page. You may get the XPath of a web
element there, as shown below (in Chrome):

The copied XPath for the second “Click here” link in the example:
//*[@id="container"]/div[3]/div[2]/a

It works. However, I do not recommend this approach as the test script is


fragile. If developer adds another div under <div id='container'>, the copied
XPath is no longer correct for the element while //div[contains(text(),
"Second")]/a[text()="Click here"] still works.

In summary, XPath is a very powerful way to locating web elements when by_id,
by_name or by_link_text are not applicable. Try to use a XPath expression that
is less vulnerable to structure changes around the web element.

2.7 Find element by Tag Name


There are a limited set of tag names in HTML. In other words, many elements share the same
tag names on a web page. We normally don’t use the tag_name locator by itself to locate an
element. We often use it with others in a chained locators (see the section below). However,
there is an exception.

driver.find_element_by_tag_name("body").text

The above test statement returns the text view of a web page. This is a very useful one as
Selenium WebDriver does not have built-in method to return the text of a web page.
Locating web elements 18

2.8 Find element by Class Name


The class attribute of a HTML element is used for styling. It can also be used for identifying
elements. Commonly, a HTML element’s class attribute has multiple values, like below.

<a href="back.html" class="btn btn-default">Cancel</a>


<input type="submit" class="btn btn-deault btn-primary">Submit</input>

You may use any one of them.

driver.find_element_by_class_name("btn-primary").click() # Submit button


driver.find_element_by_class_name("btn").click() # Cancel link

# the below will return error "Compound class names not permitted"
# driver.find_element_by_class_name("btn btn-deault btn-primary").click()

The class_name locator is convenient for testing JavaScript/CSS libraries (such as TinyMCE)
which typically use a set of defined class names.

# inline editing
driver.find_element_by_id("client_notes").click()
time.sleep(0.5)
driver.find_element_by_class_name("editable-textarea").send_keys("inline notes")
time.sleep(0.5)
driver.find_element_by_class_name("editable-submit").click()

2.9 Find element by CSS Selector


You may also use CSS Path to locate a web element.

driver.find_element_by_css_selector("#div2 > input[type='checkbox']").click()

However, the use of CSS selector is generally more prone to structure changes of a web page.

2.10 Chain find_element to find child elements


For a page containing more than one elements with the same attributes, like the one below,
we could use XPath locator.
Locating web elements 19

<div id="div1">
<input type="checkbox" name="same" value="on"> Same checkbox in Div 1
</div>
<div id="div2">
<input type="checkbox" name="same" value="on"> Same checkbox in Div 2
</div>

There is another way: chain find_element to find a child element.

driver.find_element_by_id("div2").find_element_by_name("same").click()

2.11 Find multiple elements


As its name suggests, find_elements return a list of matched elements. Its syntax is exactly
the same as find_element, i.e. can use any of 8 locators.
The test statements will find two checkboxes under div#container and click the second
one.

xpath_str = "//div[@id='container']//input[@type='checkbox']"
checkbox_elems = driver.find_elements_by_xpath(xpath_str)
print(len(checkbox_elems)) # => 2
checkbox_elems[1].click()

Sometimes find_element fails due to multiple matching elements on a page, which you
were not aware of. find_elements will come in handy to find them out.
3. Hyperlink
Hyperlinks (or links) are fundamental elements of web pages. As a matter of fact, it is
hyperlinks that makes the World Wide Web possible. A sample link is provided below, along
with the HTML source.

HTML Source

<a href="index.html" id="recommend_selenium_link" class="nav" data-id="123"


style="font-size: 14px;">Recommend Selenium</a>

3.1 Start browser


Testing web sites starts with a browser.

from selenium import webdriver


driver = webdriver.Firefox()
driver.get("http://testwisely.com/demo")

Use webdriver.Chrome() and webdriver.Ie() for testing in Chrome and IE respectively.


I recommend, for beginners, closing the browser window at the end of a test case.

driver.quit()

3.2 Click a link by text


Using text is probably the most direct way to click a link in Selenium, as it is what we see
on the page.

driver.find_element_by_link_text("Recommend Selenium").click()
Hyperlink 21

A Note for testers coming from Ruby


In Ruby, round brackets () is optional when calling a function.
driver.find_element(:link_text, "Register").click # OK

However, the below test script won’t work in Python.


driver.find_element_by_link_text("Register").click # wrong
driver.find_element_by_link_text("Register").click() # correct

This syntax issue is not a problem if it throws an error, but it does not. This test statement
will execute, but not clicking the link!

3.3 Click a link by ID


driver.find_element_by_id("recommend_selenium_link").click()

Furthermore, if you are testing a web site with multiple languages, using IDs is probably the
only feasible option. You do not want to write test scripts like below:

if is_italian(): # a helper function determines the locale


driver.find_element_by_link_text("Accedi").click();
elif is_chinese():
driver.find_element_by_link_text("��").click()
else:
driver.find_element_by_link_text("Sign in").click()

3.4 Click a link by partial text


driver.find_element_by_partial_link_text("partial").click()

3.5 Click a link by XPath

The example below is finding a link with text ‘Recommend Selenium’ under a <p> tag.
Hyperlink 22

driver.find_element_by_xpath("//p/a[text()='Recommend Selenium']").click()

Your might say the example before (find by :link_text) is simpler and more intuitive, that’s
correct. but let’s examine another example:

On this page, there are two ‘Click here’ links.


HTML Source

<div>
First div
<a href="link-url.html">Click here</a>
</div>
<div>
Second div
<a href="link-partial.html">Click here</a>
</div>

If a test case requires you to click the second ‘Click here’ link, the simple find_element_-
by_link_text('Click here') won’t work (as it clicks the first one). Here is a way to
accomplish using XPath:

driver.find_element_by_xpath('//div[contains(text(), "Second")]/a[text()="Click here"]').\


click()

3.6 Click Nth link with exact same label


It is not uncommon that there are more than one link with exactly the same text. By default,
Selenium will choose the first one. What if you want to click the second or Nth one?
The web page below contains three ‘Show Answer” links,

To click the second one,


Hyperlink 23

driver.find_elements_by_link_text("Show Answer")[1].click() # second link

find_elements_xxx return a list (also called array) of web controls matching the criteria in
appearing order. Selenium (in fact Python) uses 0-based indexing, i.e., the first one is 0.

3.7 Click Nth link by CSS


You may also use CSS Path to locate a web element.

# the 3rd link


driver.find_element_by_css_selector("p > a:nth-child(3)").click()

However, generally speaking, the use of stylesheet is more prone to changes.

3.8 Verify a link present or not?


assertTrue(driver.find_element_by_link_text("Recommend Selenium").is_displayed())
driver.find_element_by_link_text("Hide").click()
time.sleep(1) # delay 1 second
driver.find_element_by_link_text("Hide").click()
try:
# different from Watir, selenium returns element not found if hidden
# the below will throw NoSuchElementException
self.assertFalse(driver.find_element_by_link_text("Recommend Selenium").is_displayed())
except:
print("[Selenium] The hidden link cannot be found")

driver.find_element_by_link_text("Show").click()
time.sleep(1)
self.assertTrue(driver.find_element_by_link_text("Recommend Selenium").is_displayed())

3.9 Getting link data attributes


Once a web control is identified, we can get its other attributes of the element. This is
generally applicable to most of the controls.
Hyperlink 24

elem = driver.find_element_by_link_text("Recommend Selenium")


assertIn("/site/index.html", elem.get_attribute("href"))
assertEqual(elem.get_attribute("id"), "recommend_selenium_link")
elem = driver.find_element_by_id("recommend_selenium_link") # alternative locator
assertEqual(elem.text, "Recommend Selenium")
assertEqual(elem.tag_name, "a")

Also you can get the value of custom attributes of this element and its inline CSS style.

assertEqual(elem.get_attribute("style"), "font-size: 14px;")


assertEqual(elem.get_attribute("data-id"), "123")

3.10 Test links open a new browser window


Clicking the link below will open the linked URL in a new browser window or tab.

<a href="http://testwisely.com/demo" target="_blank">Open new window</a>

While we could use switch_to method (see chapter 10) to find the new browser window, it
will be easier to perform all testing within one browser window. Here is how:

current_url = driver.current_url
new_window_url = driver.find_element_by_link_text("Open new window").get_attribute("href")
driver.get(new_window_url)
# ... testing on new site
driver.find_element_by_name("name").send_keys("sometext")
driver.get(current_url) # back

In this test script, we use a local variable (a programming term) ‘current_url’ to store the
current URL.
4. Button
Buttons can come in two forms - standard and submit buttons. Standard buttons are usually
created by the ‘button’ tag, whereas submit buttons are created by the ‘input’ tag (normally
within form controls).

HTML Source

<button id="selenium_btn" class="nav" data-id="123" style="font-size: 14px;">


Choose Selenium</button>
<!-- ... -->
<form name="input" action="index.html" method="get">
Username: <input type="text" name="user">
<input type="submit" name="submit_action" value="Submit">
</form>

Please note that some controls look like buttons, but are actually hyperlinks by CSS styling.

4.1 Click a button by text


driver.find_element_by_xpath("//button[contains(text(),'Choose Selenium')]").click()

4.2 Click a form button by text


For an input button (in a HTML input tag) in a form, the text shown on the button is the
‘value’ attribute which might contain extra spaces or invisible characters.
Button 26

<input type="submit" name="submit_action" value="Space After "/>

The test script below will fail as there is a space character in the end.

driver.find_element_by_xpath("//input[@value='Space After']").click()

Changing to match the value exactly will fix it.

driver.find_element_by_xpath("//input[@value='Space After ']").click()

4.3 Submit a form


In the official Selenium tutorial, the operation of clicking a form submit button is done by
calling submit function on an input element within a form. For example, the test script below
is to test user sign in.

username_element = driver.find_element_by_name("user")
username_element.send_keys("agileway")
password_element = driver.find_element_by_name("password")
password_element.send_keys("secret")
username_element.submit()

However, this is not my preferred approach. Whenever possible, I write test scripts this way:
one test step corresponds to one user operation, such as a text entry or a mouse click. This
helps me to identify issues quicker during test debugging. Using submit means testers need
a step to define a variable to store an identified element (line 1 in above test script), to me, it
breaks the flow. Here is my version:

driver.find_element_by_name("user").send_keys("agileway")
driver.find_element_by_name("password").send_keys("secret")
driver.find_element_by_xpath("//input[@value='Sign in']").click()

Furthermore, if there is more than one submit button (unlikely but possible) in a form, calling
submit is equivalent to clicking the first submit button only, which might cause confusion.

4.4 Click a button by ID


As always, a better way to identify a button is to use IDs. This applies to all controls, if there
are IDs present.
Button 27

driver.find_element_by_id("choose_selenium_btn").click()

For testers who work with the development team, rather than spending hours
finding a way to identify a web control, just go to programmers and ask them to
add IDs. It usually takes very little effort for programmers to do so.

4.5 Click a button by name


In an input button, we can use a new generic attribute name to locate a control.

driver.find_element_by_name("submit_action").click()

4.6 Click a image button

There is also another type of ‘button’: an image that works like a submit button in a form.

<input type="image" src="images/button_go.jpg"/>

Besides using ID, the button can also be identified by using src attribute.

driver.find_element_by_xpath("//input[contains(@src, 'button_go.jpg')]").click()

4.7 Click a button via JavaScript


You may also invoke clicking a button via JavaScript. I had a case where normal approaches
didn’t click a button reliably on Firefox, but this JavaScript way worked well.

the_btn = driver.find_element_by_id("searchBtn")
driver.execute_script("arguments[0].click();", the_btn);

The state of a button can be controlled by JavaScript as well, such as:


Exploring the Variety of Random
Documents with Different Content
oxidación continuada (desasiiuilación). 4." A'utrición, asimilación. -
Esta pérdida de substancia está compensada |>or la adición al
protoplasma de materiales tomados del medio exterior (nutrición) y
que son transformados en jirotoplasma (asimilación). La asimilación
puede ser igual, inferior ó suiwríor á la desasimilación, de manera
que el volumen del protoplasma puede permanecer estacionario,
aumentar ó disminuir. 5." Xejiroduecián. - Las masas protojilásmicas
no pueden ]>asar de ciertas dimensiones, l'no vez alcanzado el
máximum, el protoplasma se divide en dos masas igualmente
nueleadas y de las que cada una tiene los mismas propiedades de la
primitiva. Un ser viviente dclw siempre su existencia á otro ser
viviente anterior. Por lo menos, no se ha oliservado nunca la
formación de un ser dotado de vida á ex|ortante que todos los
(lemas en el sentido de que existe en todos loa aeres vivientes, y no
existe más que en ellos, y qne en consoeneneia Iwst.ii í*
446 ORP.A para definir la actividad especial, que se llama
Kiáa. Aunque el protoplasnia esté en un cambio continuado de
elementos con el medio exterior, incorporándose constantemente
substancias tomadas de este niedio,cuyaconi|iosición es diferente de
la suya propia, y cuya adición parece del>ería modificar su
constitución , ]iermaiiece siempre idéntica su forma, y su
comiiosición parece ser absolutamente constante, lo mismo que sus
propiedades específicas. Dicho de otra manera, con las substancias
tomadas al medio exterior fabrica protoplasma idéntico al
protoplasnia primitivo. Esto es lo que Le Daiitec expresa, de una
manera matemática, por la ecuación siguiente, que llama ecuación
de la rula manifiesta: v-^A = ^V•^R. En esta ecuación, V
representa el peso inicial del protoplasnia; A, el peso de las
substancias tomadas al medio exterior en un tieni|)0 dado; R, el
peso de las substancias eliminadas en el mismo tiempo, y X un
coeficiente de crecimiento de peso del protoplasma. Puede suceder
que, en condiciones determinadas, los A y R sean muy pequeños y
(pie el coeficiente X permanezca sensiblemente igual á 1. Xo hay
entonces intercambio sensililc entre el ser vivo y el medio exterior, y
se dice que aquél estíi en estado de vida /airante. Pero si las
condiciones le vuelven á ser favonables, torna d recobrar toda su
actividad ; puede, pues, volver al estado de vida manifiesta. Si, por
el contrario, el estado de indiferencia química que acabamos de
definir es definitivo, aun cuando las condiciones vuelvan á ser
favorables, dicho estildo no cesa: el ser ha muerto. Es sabido que los
seres vivientes han sido divididos en dos grandes reinos: los
animales }' los vegetales. En los tipos superiores de cada reino la
diferencia es clarísima: el animal cstA dotado de sensibilidad que se
acusa exteriormentc por la movilidad; y el vegetal no. Pero,
conforme se desciende en la escala, van siendo menos perceptibles
las diferencias, á tal punto, que ciertos organismos elementales,
como los géneros Monos, Protomyxa y Vampirclla, son clasificados
por unos autores entre los animales y por otros entre los vegetales,
sin que en realidad correspondan exclusivamente á ninguno de los
dos reinos. Lo más ajustado á la verdad és decir que poseen en su
desarrollo una fase animal, el de zoosporo movible, y otra vegetal
después que el nuevo talo se envuelve en una cubierta celulósica.
Una cosa análoga sucede con muchas algas, que, aunque vegetales
indiscutiblemente en su fase adulta, poseen células reproductoras
(gametos) dotadas de movilidad. * ÓRGANO: Okoaso.s anexo.s: V.
Anejos del feto en nuestro artículo Ane.to, JA, en el tomo
correspondiente del Diccionario. -Como el órgano, ó Como i,o.s
cárganos, DE MúsTOLE.s: fr. con que se denota que algunas cosas
están colocadas sin la igualdad ó buen orden que debieran tener.
-Órganos: m. pl. Oeol. Nombre bajo el cual se designan las
formaciones de basalto, que por efecto de las litoclasas se dividen
en largos prismas y toman el aspecto de tubos de órgano. Las más
célebres son las de Saint í'lour y de Murat en la Anvernia y las de la
gruta de Fingal en la isla de Staffa. ORGANOGENIA (de órgano y del
gr. gened, origen): f. Biol. Estudio de la formación, aparición y
desenvolvimiento de los órganos, desdo el instante en que los
elementos de un tejido toman una conformación especial, hasta su
estado de completo desarrollo, de atrofia ó do reabsorción.
ORQANOQÉNICO, NICA: adj. Perteneciente ó relativo á la
organogenia. 0RGAN0QENI8TA: ni. lüólogo especialmente dedir-ado
al estudio ríe la organogenia. ORGANÓQENO, GENA: adj. Relativo á
la organogenia. ¡ OROANOOÍSIfO. ORGANOGRAfiCO, ficA: adj.
Perteneciente 6 relativo á la organograffa. -Términos
oROANooRtFicns: Aquellos do qne non servimos, en la descriiición
uestos de mercurio, reaccionan sobre el j-odo ó sobre los hidiácidos
para dar combinaciones análogas á sales. El estaño-metilo S)i(CH')''
hierve á 78°, elcstaño-etilo S)i(C-H-^)^ hierve á 181°. El agua no
los descompone. El yodo da los yoduros corres pendientes, por
ejemplo, el yoduro de cstañoirietilo Sn(C-H'')". El plomo, metal
tetravalente como el anterior, pero con más frecuencia bivalente, da
compuestps análogos por una reacción del todo parecida, utilizando
las aleaciones de plomo y de sodio. El plomo-metilo Pi(CHS)J hierve
á 110° y el plomo etilo á 200°; son indescomponibles por el agua. El
níquel es también tetravalente, aunque más á menudo bivalente,
sobre todo en la química mineral ; pero no se le conocen
compuestos análogos al del metal precedente: puede tal vez, sin
embargo, inscribirse aquí el níquel tetrncarbimiloNi{CO)*. El hierro
¡eidacarbunilo F-(CO)", que proviene de la dcscomivosición del
procedente bajo la inlluencia de la luz. ORGANOPÁTICO, TICA: adj.
Perteneciente ó relativo á la organo]mtía. ORGANOPATISMO ú
0RGAN0PAT0L00I8M0: ni. Palo!. Teoría que niega la existencia de la
enfermedad cu cnanto se la considera como un conjunto y succ.siiín
de lesiones y de estados dinámicos ó sintomatológicos
correspondientes, y afirma que stílo existen órganos enfermos en
mayor ó menor número, con afecciones diversas, on distintos
grados, en cada caso ¡larticular, de tal manera (pie la enfermedad de
cada uno de ellos
The text on this page is estimated to be only 25.41%
accurate

lio ¡iiifilp relacionarse ni ser eoiiiparada exactamente íi la (lo


nin-íún otro. (Piorry. ) ORGANOPLASTIA (de órgano y del gr.
phiascin, formar): f. Bio/, Generación de los órganos. -Organoplastia
hioiiínica: Arte de alcanzar el desarrollo de ciertos órganos jior medio
de un ejercicio ajiropiado, y de iiioeuiar el lucdoiiiinio ó la diminuüióu
y aun la desajiarieióu de aljamio San Vicente y Vahos, con un total
de 61 000 habits. En 1908 pa.saron al dep. de Sonsón. 1| La prov.
colombiana de esto nombre, en el dc|>artaiiiento de Cundinamarca,
comprendía los municipios de Cáqneza (cap.), Chipaque, Choachí,
Kónieque. Fosca, Gutiérrez, Qnetame, Uliaque y Une, y tenía 42500
habits. Eu 1908 itasaron al dep. de Zipaquirá. - Oriente (CiRSTiÓN
be): ITisl. V. Grecia, Macedón ia y Turquía en los tomos
corrcs|>oudientesdcl Diccionario y eu este mismo Apéndice.
ORIFICABLE: adj. Que puede orificarse. ORIFICACIÓN: f. Acción y
efecto de orificar. ORIFICADOR: ni. instrumento que sirve (lara
orillear. ORIFICAR (del lat. aií)-n7«, oro, y /acere, hacer): a. Rellenar
con oro la picadura de una muela ó de un diente. * ORIGEN: ni.
Original. ... y deleitándolas (sui imaginaciones) con el apacible
retrato de Tecla, que en su nieuioria p.ireiia más (iUIGrn que
traslado, trocó en los ojos el tr,->slado por el origen, viendo delante
de ellos que en traje de peregrino, si alííinrniturH del agua ea de "¿y.
y su esin'ciulizacióii, A la que debo el nionanlinl
448 ORIV 31'eciente renomlue y lama, es la sífilis. La
instalación es buena, ORILLADA: f. ant. Orilla, borde. Las dos cruces
caberas que en la ORILLADA faz el preste del cáliz con la hostia
sngrada. Gonzalo de Berceo, ORILLAR: m. Reborde. Quedan las
piedras con un ribete relevado afuera, ó con un orillar hundirlo. Fr.
Pedro de Vega. ORILLEAR: n. Mar. Lo mismo quo verilear.
ORINADOR: ni. Lugar destinado para orinar: Urinario. * ORINAL:
Orinal del cielo: fig. y fam. Taraje donde llueve con mucha
frecuencia. ORINCAR: a. Mar, Poner orinque li un ancla ó anclote.
ORINOCA: Gcog. Vicecantón de la jirov. do Carangas, dep. de Oruro,
Solivia; 1722 habits. 121 pueblo está cerca de la orilla O. del lago de
rampa-Aullagas. ORINOQUIA: f. Región del río Orinoco. * ORINQUE:
Mar. Orinque de costa: El que por lo regular tiene cincuenta brazas
de largo ¡lara fondear sobre las costas ó en parajes de uiuclia
profundidad. ORINQUEAR: a. Mar. Probar ó tantear en ciertos casos
si un ancla está agarrada en el fondo, tirando para ello del orinque.
* ORIOL (El Beato José): Biog. Fué canonizado solemnemente en
Roma el día 20 de mayo de 1909, y á la misa papal asistieron el
colegio de cardenales, los ai-zobispos y obispos españoles y otros
doscientos prelados de diversas naciones. -Oriol-les-Eaux; Geog.
Aldea del municipio de Cornillon-en-Trieves, dist. de Grenoble, dep.
del Isére, Francia. Aguas minerales frías, bicarbonatadas, calcicas,
ferruginosas, indicadas contra la anemia, la clorosis y las
enfermedades de las vías urinarias. ORIOLANO, NA: adj . Natural de
Oribuela (Alicante). U. t. c. s. || Perteneciente ó relativo á dicha
población española. ORITIA: Mü. Reina de las amazonas, admirada
tanto jior su talento militar como por su virtud. A su valor se debió
que el nombre de las amazonas fuese tan temido y grande, que el
rey Euristeo enviase á Hércules á traerle las armas de la reina. Oiitia
compartía el trono con su hermana Antiope, la cual, durante la
ausencia de la ¡irimera, fué sorprendida por el héroe griego, que
cumplió el encargo de Euristeo. Enteradla Oritia, pidió socorro al rey
de Escitia para vengar tamaña afrenta, y éste le envía su hijo con un
gran cuerpo de caballería; pero divididos entre sí los auxiliares en la
hora del combate, abandonan á las amazonas, que entonces fueron
vencidas ])or los atenienses. Oritia pereció peleando. ORIUNDEZ: f.
Ascendencia, origen. ... como bien )o indican y persuaden loe cien
apellidos de abolengo que por ahí tienen su solariego, pero que de
aquí traen su oril'ndk.z. ORIVAY DE MONREAL (JirAN BaUTLSTA'fíwg.
Natural de Valencia. Estudió Filosofía y Medicina en la universidad de
su patria, "laduándose de maestro en Artes y doctor en la última
facultad. Fué catedrático de Teórica de Ilipocrates y de lengua
griega, y regente de diimtado general del Reino por el lirazo de
ciudadanos é hijosdalgo. Comisionado para visitar Murcia,
Cartagena, Oribuela y otras poblaciones atacadas de (icste,
descubrió en seguida el origen y causas del contagio. Escribió:
Propminamhnn J/ippocralica: et Oaleniccc doctrina; de Fcbriiim
putrídarum, etc. (1679, 4.°); Tkcatro de la Verdad... de loa
enfermedades de la ciudad de Orihuela del año 1678: pruébase no
haber sido peste ni su contagio, sino calenturas malignas con forma
vulgar, nacidas de pobreza, haníluc, malos alimentos y destemplanza
del tiempo (Zaragoza, herederos de Diego Dormcr, 1679, 4.°) y
Vumimnlariiim II, in sentftit. XXIX, lib. 11 apliori.im. Ilip/ioc. de
snnguini» míiione in f¿ brinm piilridariim euralione exereeiida.
ORIVE: ni. Orífice. ORLE * ÓRJIVA: Geog. El p. j. de este nombre,
en la prov. de Granada, tiene 825 kms.s y 31 750 habits. Sus 30
ayunt. comprenden 5 v., 27 lugares, 2 aldeas, 15 caseríos y 1386
edif. y albergues aislados. El ayunt. de Orjiva tiene 97 kilómetros
cuadrados y 4371 habits., de los que 3099 corresponden á la v. que
le da nombre y el resto á dos cortijadas y á edif. y albergues
diseminados. ORJIVEÑO, ÑA: adj. Natural de Órjiva (Granada). U. t.
c. s. i; Perteneciente ó relativo á dicha población española. ORLA:
Imj,r. Adornos de varios cuerpos, dibujos y estilo, susceptibles de
iulinitas combinaciones. ORLANDi (Fernando): Biog. Compositor
italiano, n. enParma en 1777;"ni. en Munich en 1840. Después de
darse á conocer como comijositor, fué profesor de los pajes del
virrey de Italia y de solfeo del conservatorio de Milán. Instalado en
Munich, le encargaron en aquella escuela de la clase de canto.
Escribió varias óperas que alcanzaron buen éxito y de las que
citaremos: Dama sáldalo; Ifurbi alie nozze; Le nozze chimcriche; La
villanella fortúnala; V amorc stravagantc; Rodrigo di Valenza; La
sposa contrástala, é 11 Baloardo. ORLANDO (Víctor Manuel): Bioq.
Escritor y político italiano contemporáneo. Es profesor de Derecho
público en la universidad de Roma y ha sido ministro de Instrucción
pública. Orador brillante, se cita entre sus mejores discursos el que
pronunció con motivo de las fiestas de Arczzo en honor de Petrarca,
que se celebraron en la época en que Oriando era ministro. Desús
aficiones literarias ha dado gallarda muestra con algunas poesías y
varios estudios sobre la sátira y sobre mitología. Es también autor de
magistrales obras de Derecho político y administrativo. -Orlando da
Silva (Arturo): Biog. Escritor brasileño, u. el 29 de julio de 1858. Es
doctor en ciencias jurídicas y sociales, redactor en jefe del Diario de
Pernambiico, individuo de la Academia de Letras y del Instituto
arqueológico de la misma ciudad, diputado al Congreso federal y ex
director de instrucción pública del Estado de Pernambuco. Sus obras
más celebradas son la Propedéutica politico-jurídicay los Ensaios de
crítica. ORLAR: a. Impr. Cerrar un molde con orla ORLEANÉS, NESA:
adj. Natural de Orleáns. U. t. c. s. II Perteneciente ó relativo á dicha
ciudad francesa. ORLEANISMO: m. Sistema político de los
orleanistas. ORLEANISTA: adj. Partidario de la casa de Orieáns. U. t.
c. s. || Perteneciente ó relativo á ella. ORLEANS (Enrique de): Biog.
Príncipe y explorador francés, n. en Haní (Inglaterra) el 16 de
octubre de 1867: m. en Saigón el 9dea
las conchas, corales y crinoideos que contiene y por Iftó
venas que los cruzan en diferentes intervalos. Tales [liedras son
blandas y, por consiguiente, fáciles de trabajar, de aserrar en
planchas y pulimentar, haciéndose con ellas columnas, lechos,
tableros para mesas y consolas, y pavimentos decorativos. El
alabastro es una variedad granular de yeso, blanca, amarilla ó
rosada y muy blanda; pero á veces se venden bajo este nombre
calizas granulares y estalactíticas. La serpentina es verde obscura,
amarilla ó roja, y ordinariamente jas]ieada, usándose principalmente
para la ornamentación en pequeñas masas. Los pórfidos más
conocidos son el rojo, que procede do Egipto, y el verde, que en su
origen procedía de Grecia. También se utilizan como piedras
decorativas el jaspe, el ónice, la ágata y la pizarra negra. En estos
últimos años ha alcanzado gran incremento la fabricación de
mármoles y serpentinas artilieiales. Esta se obtiene por dos
métodos. Una plancha de pizarra, madera ó hierro esmaltado, puede
pintarse á mano: pero, aunque á veces se encuentran imitaciones
muy bien hechas, el resultado deja siempre mucho que desear. Otras
veces se incrustan trozos de mármol en una masa de contextura
análoga, pero algo diferente de color,' y cuando el conjunto está bien
compacto, se sierra en planchas y se pulimenta. ORNDORFF
(Guillermo Ridoelt): Biog. Químico norteamericano contemporáneo.
N. en Haltimore el 9 de se])tiembre de 1862. Terminados sus
estudios y después de haber sido varios años profesor auxiliar en
algunos colegios y universidades, vino á Europa á ¡lerfeccionar sus
estudios en las universidades de Greifswaid, Berlín y Heidelberg,
desempeilando á su regreso la cátedra de Química orgánica y
fisiológica en la universidad de Cornell. Orndortf hadesempeñado
también otros cargos y comisiones de gran importancia, entre ellos
el de miembro del jurado internacional de premios en las
exposiciones de París y San Luis, secretario del jurado del
departamento de Artes liberales, agente especial del censo de los
Estados Unidos, etc. Ha colaborado mucho en la prensa científica.
Ha escrito una obra titulada Manual de laboratorio de química
orgiiniía, y ha traducido del alemán la de E. Salkowski ilanunl de
laboratorio de química fisiológica 1/ patuló'jica. ORNITlVORO, RA
(del gr. ómis, imizos, ave, y varare, comer): adj. Que se alimenta de
aves. ORNITÓFILO, LA (del gr. ómis, órnizos, ave, y filos, amigo):
adj. Alicionado á los pájaros. ORNITOLÓGICO, CA: adj.
Perteneciente ó relativo á la ornitología. ORNITÓLOGO: m. El que
profesa la ornitología ó tiene en ella especiales conocimientos. *
ORO: Oro de Ofii:: El muy acendrado. Ca«la tribu hechizado se
euliilara en el ouo de Ofui de tu cabello. Cai-Debón. -• Ono MOLIDO:
El que resulta de disolver el metal en agua regia y empa|>ar en el
líquido obtenido trapos de hilo, que después se queman ]iara
recoger las cenizas, donde se encuentra el oro en polvo. -Oro
coloidal eléctrico ( Eleetraurol ): Terap. V. Metales coloidales en esto
mismo Apéndice. - Oro musivo: Gisulfuro de estado, de color de oro,
que se emplea en pintura y para algunos otros usos. -Panes de oro:
V. Batido en este mismo Ai-índice. - Boca de ORO y Pico de oro
llamamos en castellano á la |>er8ona que habla bien, como la
llamaban los griegos jnudi/omo», Aajrusús, oro, y stóma, boca; y
¡Suena pluma ó Pluma de oitoal escritor excelente: esto quieren
significar también las frases Hablar oiio y Escribir oro, ú otras
semejantes, i|ue han estado y están en uso. La nave que A Portugal
dio Uauto en vez de te-¡oro. Coniferas cnn Untas de ORO vuelve en
Argos celc.itínl. Loi'K DK Veoa. (Quién podrá con nn criailo que en
hablaros os da oro? Tomo XXVIll, Afindice ¡i ORO Antes esperaré uu
toro que veer un necio liiuchado como prior en el coro. M.
deGallkgos. -De ono en or.o: m. adv. Al contado. € Yo soy el que os
ofrecí los mil escudos por este retrato; si le queréis dar, traeiile y
venios conmigo, que yo os los daré luego DE ouo EN ORO.»
Cervantes. - El saiíio es es sv patria cosió el or.o OCULTO EN LA
MINA: fr. prov., tomada de los árabes, y equivalente á la «Nadie es
¡irofeta en su patria.» -Mí TALADRA ES PRENDA DE ORO: fr. COU
que se pondera la seguridad que debe tener el que oye en la oferta
que se le hace, por valer ésta más que si se diera en prenda ó seBal
una alhaja ó moneda de oro. - Por TODO el oro del mundo: fr. con
que se pondera lo resuelta que está una persona á no hacer tal ó
cual cosa á ningún precio ni por ninguna consideración. -Oro: Mit. El
último de los dioses que reinaron en el antiguo Egipto y que
suponen hijo de Osiris y de Isis. Hizo la guerra al tirano Tifón,
asesino de Osiris, y después de haberle vencido y muerto por su
propia mano, subió al trono de su padre. Las imágenes que
representan á Oro suelen acompañar á las de Isis en los
monumentos egipcios más remotos (V. HoRUS en el tomo
correspondiente del Diccionario). -Oro: Miner. y Geol. Yacimientos de
oro: El oro es un cuerpo escaso, pero muy difundido en el globo.
Existe combinado con el teluro, como en la silvanita, que es un
telurato de oro y plata. Pero, en la inmensa mayoría de los casos, se
encuentra cu estado nativo aunque íntimamente mezclado con otros
elementos, asociado á las piritas de cobre y hierro, y á la plata roja,
ó aleado con otros metales. También se encuentra disuelto en el
agua del mar en proporción infinitesimal, i>ero que en ciertas
regiones se hace bastante sensible: según Levesdridge, frente á las
costas de Nueva Gales del Sur, cada metro cúbico de agua
contendría 65 miligramos de oro. Las formas de yacimiento pueden
reducirse principalmente á dos: en filón o roca, y en terrenos
detríticos. Los filones atraviesan rocas granudo cristalinas ó
pizarrosas, y en ellas la substancia que arma el metal suele ser el
cuarzo. En la vertiente occidental de las montañas Rocos.-íS se ha
explotado durante largo tiempo un vasto filón, el Comstock lodc, en
forma de V, cuya abertura, vuelta al exterior, no tiene menos de 300
m. de anchura, encontrándose su vértice á 500 m. de la superficie;
las dos ramas de la V están constituidas por cuarzo pobre, y el
interior está formado de una mezcla de cuarzo aurífero, y de
fragmentos de rocas duras y de arcillas, procedentes de su
descomposición. Las partes ricas en oro formaban espacios
irregulares llamados bonanzas, de los cuales el. principal tenía 300
m. de longitud por 250 m. de altura media. Este filón se llenó al final
del período mioceno. Está en relación con una andesita, y las
emanaciones solfatáricas que acompañaron y siguieron á la abertura
de esta roca dieron lugar á que se llenara el filón y á la alteración de
las rocas vecinas. En Venezuela y Guayana los filones de cuarzo
aurífero atraviesan una diorita muy compacta y ofrecen tres zonas
diferenciadas: una de pepitas y laminillas diseminadas, con huellas
do cristales de pirita desaparecidos; otra, media, de cuar zo pobre; y
otra, profunda, en la que el cuarzo presenta una cantidad do
cristales do pirita aurífera, que llevan oro nativo en su superficie. En
Australia el metal se encuentra en venillas ó en partículas en una
ganga mazosa que atraviesa, solire todo, las pizanas. Las rocas
auríferas detríticas son las formadas por desmenuzamiento natural
do las cristalinas ó pizarrosas preexistentes que rontenfun el metal
en su masa ó en sus filones. En ciertos casos no hay más que
descomposición tii situ. En otros sobreviene el acarreo, es decir, el
trans|ara eso se requieren trituradores especiales: tal es el molino
Crawlbrd. Este aparato se compone de un espacio cerrado, coronudo
por una tolva, bajo la cual gira una mesa de hierro sobre nn eje que
le sirve de quicio. En la parte inferior del de|H)8Íto hay un tubo de
comunicación. El mineral, triturado y echado por la tolva, cae sobro
la mesa giratoria, donde es pulverizado por la acción da unas bolas
de hierro que descansan encima y empiezan á rodar en cuanto la
mesa gire. El polvo obtenido pasa, por unos orificios, al dei>ósito de
mercurio. Allí el oro se amalgama y la ganga Ilota. Una corriente de
agua á pri -^1. 11 .m,- In .'.-i porcl tubodeconiunicaci.ln.arní-' la
eleva en fango muy líquido en. acabando por nmiinr iil ivtii;. : Con
los procedinii' ■ | iiidi l-m.nciarso la mitad df . mientras que con el
molino Ci.i i .i obtener del CO al 90 ¡H.r 100. La amalgama do oro,
obtenida por medio de tableros, de mesas do tinc ó de molinos
amalgamadorei. no es pura, |iues contieno algo do metal de los
útiles que han servido jmra trabajar el niiuoral (zinc, cobro), y, sobre
todo, do hierro proco67
450 ORO dente del desgaste de las herramientas. Se lava
dicha amalgama con agua caliente, ó al carbonato de cal, luego se
riltra y se destila como se ha dicho ya. Los residuos de la trituración
forman un barro que aún contiene oro. Cuando hay piritas, se las
coloca sobre una criba, donde se aislan las partículas de pirita,
pasando el menudo á una especie de caja, en la cual se hace la
selección. Allí donde no hay piritas, el barro llega directamente de
los aparatos amalganiadores á esta caja. La selección consiste en
separar por la corriente, las arenas gruesas de las finas. Las gruesas
se echan en grandes cubas de madera, provistas de doble fondo, en
las que el superior es una esterilla de libras de coco y cuyo intervalo
está lleno de arena y gaaijarros. Allí se someten á una lexiviación
con una solución de cianuro de potasio, que se une al oro para
formar un cianuro doble. Al principio, se hace obrar una solución de
0,4 á 0.» por 100 durante doce horas; luego, una segunda solución
de 0,2 á0,4por 100, y, p'jr último, se hace pasar una corriente de
agua. La solución de cianuro doble se vierte por una llave colocada
en el fondo. En seguida se procede á la precipitación, que puede
electuarse por el zinc ó por la electrólisis. Para lo primero se
emplean unos aparatos llamados extractores, largas cajas, divididas
en compartimientos ¡>or tabiques verticales, y transversalmente en
dos ó tres pisos de radios de tela metálica, que llevan el zinc en
limaduras, preparadas á medida que va siendo necesario. Al liquido
se le obliga á atravesar sucesivamente todos los compartimientos de
arriba abajo. El zinc sustituye al oro en el cianuro doble, y el metal
precioso cae al fondo: un filtro, colocado al lado de la caja, retiene el
metal arrastrado. Para desembarazarse del escaso zinc que
acompaña al oro, se trata por el calor el polvo metálico resultante, ó
bien se hace obrar sobre él, en un recipiente de madera, al ácido
sulfúrico, que disuelve el zinc, y se somete el todo á un filtro prensa.
La pasta obtenida se funde en un horno de corriente de aire. El
cianuro doble, adicionado con un poco de cianuro de potasio, puede
volver á servir. Para aplicar la electrólisis, se somete la solución de
cianuro á la acción de una corriente eléctrica, con auxilio de ánodos
de hierro y de cátodos de plomo; el oro se precipita sobre este
último metal. Los cátodos son fundidos y sometidos á la copelación
cada mes. También se ha intentado hacer depositar el oro sobre
placas de bien o, que se sumergen luego durante un minuto en un
baño de plomo fundido, formándose una aleación. Esta aleación se
enriquece sumergiendo nuevas placas, y se extrae luego metal muy
puro por la copelación. En cuanto á las arenas finas, se tratan
poruña solución de cianuro de potasio, muy débil, se decanto el
h'quiJo en lugar de filtrarlo y se precipita por la electrólisis.
Extracción por cloruración. - Es el procedimiento que se emplea para
el tratamiento de piritas auríferas y de sulfurilas, ó residuos
]>iritosos, procedentes del método anterior. Se empieza tratando
por el fuego el mineral, para eliminar el azufre y con él el arsénico y
el antimonio, que se encuentra á menudo en estas piritas, no
quedando más que óxidos. Una vez tratado el mineral por el fuego,
se llevan los residuos á un recipiente de madera alquitranada, de
dos fondos, generalmente móviles, alrededor de gorrones, o bien se
cmiilean toneles giratorios de madera alquitranada, de hierro ó
forrado de plomo. Cuando el recipiente es una cuba de dos fondos,
el superior es de arenisca atravesada de agujeros. Entre los dos
fondos, se encuentran fragmentos de cuarzo. La materia que se ha
de tratar no debe introducirse ni demasiado húmeda, ni
excesivamente seca. Se cierra, se da entrada al cloro (ciertos
explotadores los producen en la misma cuba), se le deja obrar seis ó
doce lioras, y luego se macera durante uno ó dos días, según el
estado de división de la materia sólida. Cuanto más pulverulenta ca,
más rá]>ida resulta la cloruración. Se obre después la cuba, se tapa
el depósito con un lienzo grueso y so riega lentamente con agua.
Este líquido arrastra el cloniro de oro que se ha formado, y lo hace
salir ])or la tubería del fondo, jinxando directamente á un canal de
madera que lo conduce á un dejiósito, donde se clarifica |ior el
reposo (si está demasiado turbio, so filtra antes). Una vez
clarificado, se hace pasar á los dojiósitos do precipitaciúH. ORO El
oro de la solución de cloruro se precipita jior el sulfato de hierro, ó
mejor, por el hidrógeno sulfurado. Solamente en este último caso es
necesario separar todo el cloro libre que hubiere podido quedar en la
solución, lo que se consigue por medio del anhídrido sulfuroso, que
produce ácido sulfúrico y ácido clorhídrico. Sólo entonces se hace
llegar una corriente de hidrógeno sulfurado, que sulfura el oro,
dando aún ácido clorhídrico. El sulfuro de oro obtenido se oxida en
el hornillo y luego se funde al crisol, con salitre y bórax, para
desoxidarlo. El oro así olitcnido no es puro, pero contiene siempre
más de 900 milésimas de oro fino. Purificación. -Sea cual fuere el
procedimiento de extracción empleado para obtener el oro, es muy
raro que pueda obtenerse enteramente puro. En general, contiene
aún plata, cobre, plomo y, algunas veces, bismuto, antimonio ó
arsénico. Es, ])ues, necesario hacerle sufrir una operación
complementaria, la purificación ó afinación. Esta operación puede
verificarse de dos maneras: por la vía química ó por la vía
electrolítica. El procedimiento químico consiste en atacar el oro bruto
por el ácido sulfúrico concentrado y en caliente. En este estado el
ácido no ataca al oro, pero forma sulfates con otros metales
mezclados con él. Una ebullición de doce horas basta para que esta
operación sea completa, desprendiéndose anhídrido sulfuroso y
depositándose el oro en forma de polvo obscuro. Como está
mezclado con el exceso de sulfates no disueltos, hay que hacerle
hervir de nuevo con el mismo ácido, algo más concentrado después
de haberlo lavado. Se funde luego con salitre, y se obtiene oro que
contiene todo lo más de 3 á 4 milésimas de plata, sin ninguna otra
impureza. Los sulfatos obtenidos se aprovechan á su vez. El
procedimiento electrolítico consiste en emplear como ánodo el oro
en bruto, en un baño de nitrato de plata, poco concentrado, siendo
el cátodo de plata. La plata del lingote en bruto se reúne con este
cátodo, y el oro queda en el ánodo en estado de disgregación. No
queda más que fundirlo y vaciarlo en una lingotera. La operación
completa dura unos dos días. - Oro (PiiODUcciÓN del): El cálculo
aproximado de la producción total del oro desde los tiempos
primitivos ofrece cierta dificultad por la falta de estadísticas
anteriormente á los tiempos modernos; pero semejante
incertidumbre influye menos de lo que se pudiera creer en el
resultado total por la escasez de oro en los siglos anteriores,
relativamente de la producción posterior al descubrimiento de
América y, sobre todo, desde mediados del siglo xix. Así, mientras
que para la Edad Media se estima en un equivalente de 300000000 á
400000000 de pesetas el oro existente cu Europa, y desde 1500 á
189S, antes del descubrimiento de las minas de California, se
extrajeron en tres siglos y medio, á todo tirar,15500000000,
actualnieutela producción mundial llega á 2000000000 ])or ailo. En
cada ano, pues, aumenta la existencia del oro tanto como en medio
siglo antes de 1S48. Resumiendo todos los datos más probables,
llegamos en números redondos, para el total de oro explotado liasta
los comienzos del siglo xx, aun total de 60000000000, ó
aproximadamente, 17600 toneladas. Si se averigua el reparto de
esos 60000000000, se encuentra una distribución entre los grandes
continentes más regular de lo que pudiera suponerse,
correspondiendo 17000000000 á la América del Norte (Estados
Unidos, Méjico y Canadá), 13200000000 á Australasia; líOOO á
12000 millones á la América del Sur; 11000 á 12000 millones para
Asia y Europa que gráficamente forman un solocontinente,y
6000000000 á África, donde la explotación industrial está mucho
menos adelantada, si bien se desarrolla rápidamente en la
actualidad. Para los principales países productores, las cifras son las
siguientes por orden de importancia y en millones de pesetas: Est.-
idos Unidos 14325 Australasia 13130 Rusia («iberia y Ural). . . . 6300
Colombia 4.190 Brasil 8 800 África del Sur 3570 Oeste africano 2000
Austria-Hungría 1765 CEO Méjico 1470 Canadá 1300 Chile 1000
China y Corea lOOO Perú 620 Guayanas 600 Venezuela 300 Entre los
distritos célebres figuran Califoniia con 7000000000, la colonia de
Victoria (Australia) con 6500000000, el Transvaal con 3500 millones,
y la Australia Occidental con 1400 millones. El predominio en la
producción ha ido pasando de unos á otros de estos países, según
los descubrimientos geográficos y geológicos. La primemera fase de
la producción mundial empezó en América (Méjico, Perú, Nueva
Granada, Chile) después de su descubrimiento por los españoles. El
siglo XVIII fué el de la gran producción del Brasil. Luego le tocó el
turno á Siberia y á los Estados Unidos. En 1848 fué descubierta la
riqueza aurífera de California, con lo cual empezó la segunda época
y principal de la gran producción. En 1851 se descubrió la de
Australia, y en 1887 la del AVitwatersrand en el Transvaal. En
tiempos más recientes se han descubierto las minas de Alaska y de
la comarca fronteriza del Canadá ( Klondike ), pero la producción,
aunque importante, no llegó á la altura de las grandes esperanzas
que hizo concebir, y pronto empezó á bajar muy sensiblemente. En
Australia, el centro principal de producción ya no es hoy (1910) el
primitivo (Victoria), sino el Oeste; y en los Estados Unidos no es
tampoco la California, sino la región de las Rocosas. El primer lugar
en el globo lo sigue ocupando AVitwatersrand. Durante el último
tercio del siglo transcurrido hasta 1905, la producción mundial fué
creciendo del siguiente modo: Producción Valor en milloPeriodos en
kgs. ne.s úe i>eset,is 1873-1875 521712 1797 1876 - 1880 830477
2860 1881 - 1885 768223 2646 1886-1890 849318 2925 1891 -
1895 1225883 4222 1896-1900 1935 741 6667 1901-1905 2418042
8329 En 1906 la distribución fué, según el Enginecrinij and Mining
Joitrnal, de los Estados Unidos, de la siguiente manera: Valor en
PAÍSES dólares del oro producido Transvaal 119605922 Estados
Unidos 97155201 Australia y Nueva Zelanda. . 82S51561 Rusia
21500000 Méjico 15430000 CaiKidá 12000000 India 106.-)5674
RhodÜBia 10201327 Otros países 85250000 Total 404649685
Cantidad que, reducida á pesetas, da, en números redondos, los
2000 miliones antes dichos. En los Estados Unidos el tanto % de la
producción citada se distribuyó así: Colorado.. . 23'5% Utala. . . .
6'8% Alaska. . . 2r2 Montana.. . 5'1 California. . 18'1 Oregón. . . l'á
Nevada. . . 9'9 Idaho.. . . l'O Dakota del S. 6'8 Otros estados y
territorios 4'0 La mayor riqueza aurífera que se ha encontrado en el
mundo es la del Witwatersrand, que representa una suma de 15 á
20000 millones, reunidos en un centenar de kilómetros cuadrados.
En proporciones mucho menores ¡lueden citarse el distrito de
Calgoorlic, en la Australia occidental, que representa un mínimo de
2000 millones; el de Crijijilc Creek, en el Colorado, cuyo valor total
jiuede calcularse en 1509 á 2000 millones; y el del Vukon, que
puede contener de 8á 900' millones. La mayor explotación minora
aurífera del mundo es la de Homestake, al Sur de Dakota, que tritura
con sus 900 pilones 1400000 toneladas de mineral por año.
The text on this page is estimated to be only 29.61%
accurate

OROC Si comparamos en peso la producción de oro con la


de hierro (que alcanza á unos 55 ó 60 niilloucs de toneladas
anuales), resulta que la Imniauidad extrae en un solo día unos
nueve veces más hierro que oro lia obtenido desde que empezó á
existir. La corteza superficial terrestre contiene, como término medio,
un 4,70 por 100 de hierro. Admitiendo, sólo para fijar los términos
de la comparación, que la cantidad de oro y de hierro contenido en
la corteza terrestre fuera proporcional á su extraccióu anual,
comparando los 73,5 millones de toneladas de hierro obtenidas en
1900 con la producción de oro, obtendríamos para este último una
proporción de 0,00025 jior 100 ó de 1 jrar 4000000. En 19J8 la
producción de este metal ha excedido en 2 millones do libras
esterlinas á la del año 1907, halnéndose observado un importante
aumento en la correspondiente al África del Sur y una diminución en
la ordinaria de Australia. A continuación insertamos dos cuadros; en
uno pueden verse las cifras acusadas poi las principales naciones
qne ¡iroporcionan este metal, y en el otro, los cambios que ha
experimentado la suma total de la producción de oro en el mundo,
desde 1850 hasta 1908. 1908 1907 1905 Transvaa] . . . 29957000
27 406000 24680000 Rliodesia. . . . 2520000 21 -8000 2000000
Al'riea occidental.. . . . . 11S6000 1155000 877000 Australasia.. . 15
077000 15 5 30000 16929000 India.. . . . . 2G64000 25 i9000
2621000 Canadá.. . . . 1676000 20 lOOOO 2300000 Est. Unid 03. .
18 202000 ISO 37000 18875000 Otros países. . 12653 000 132
■9000 12212000 84000000 82200000 80394000 pr.OOUCCIÓN I)F.
OKO EN EL MUKDO DESDE 1850 V^ilor de V.ilor lie a proiiiicciún la
proiiuccióu Libras 1880. Libras 1850. . . 11600 000 . . 22130000
1351. . . 17 200000 1881. . . 21150000 1S52. . . 36550000 1SS2. . .
20500000 1S53. . . 31090000 1883. . . 20610000 1854. . . 25
490000 18.^4. . . 20830000 18.';5. . . 27 015000 1885. . . 21250000
1856. . . 29520000 18S6. . . 21430000 1857. . . 20055000 1SS7. . .
21500000 1858. . . 24 930000 Ií88. . . 21985000 18.';9. . .
21970000 1839. . . 23835000 1860. . . 23S50000 1890. . . 24260000
ISOl. . . 22 700000 1891. . . 26700000 1862. . . 21550000 1892. . .
29 900000 1S63. . . 21390000 1893. . . 32 600000 1804. . .
22000000 1894. . . 36 765000 1865. . . 24 040000 189,5. . . 39
7.52000 1S66. . . 21220000 IS'.ie. . . 40450000 1807. . . 22 805000
1897. . . 47 762000 isas. . . 21945000 1898. . . 574S0(J00 1809. . .
21245000 1899. . . 61345000 1870. . . 21370000 1900. . . 50915
0U0 1871. . . 25 400000 1901. . . 52198000 1872. . . 24 200000
1902. . . 59348000 1873. . . 23 000000 1903. . . 65192000 1874. . .
22950000 1904. . . 69378000 1875. . . 22 700000 1905. . .
76055000 1876. . . 22540000 1906. . . 80 394 000 1877. . .
23830000 1907. . . 82200000 1878. . . 22020000 1908. . . 84000000
1879. . . 21400 000 OROBANCACEO, CEA (do orobanco): adj. Bol.
Dí*'esc df plantas ílicotiUvlóneas herbáceas, que viven adheridas á
las raíces de otras plantas; algo carnosas, con escamas en lugar de
hojas, (lores terminales solitaria.s ó en espiga, y fruto capsular con
multitud de semillas muy menudas y de albumen carnoso; como el
orobanco ó hierba tora. U. t c. 8. II f. pl. Bol. Familia de ostaa
plantas (V. OiioiiAXc.U'FA» en el lugar correspondiente del
Diccios.vRio). * OROCUÉ: Oeog. Cuando se croó la Intendencia del
Meta, en Colombia, Oíocué fué muni'ipio cabecera de la prov. del
Centro; tiene 3000 babits. OROCUINA: Ocog. Municipio del dcp. do
CheOROP luteca, Honduras; 4 720 habits. Forma dist. con el
municipio de Apacilagua. OROGENIA (del gr. uros, montaña, y
gencd, origen): f. l'arte de la Geología que estudia la formación de
las montañas. OROGÉNICO, CA: adj. Pei'tencciento ó relativo á la
orogenia. 0R0GN08IA (del gr. oros, montana, y (inSsií,
conocimiento): f. Parte de la Mineralogía que Irata de la descripción
de las montañas y de las rocas. OROHIDROGRAFIa (del gr. iros,
montana, y de hidrografía): f. Descripción de las aguas qne manan
de las montañas, o de las aguas y de las formaciones gcognóslicas
de una comarca. OROHIDROGrAfiCO, CA: adj. Perteneciente ó
relativo á la orohidrografía. OROHIPO: ni. Palconl. Género fósil de
Équidos, correspondiente al sistema eoceno de los Estados Unidos y
caracterizado por tener cuatro dedos, de los cuales el segundo es el
más largo. OROLOGIa (del gr. oros, serosidad, y lógos, discurso): f.
Estudio científico de los humores. OROMASO: Mil. Dios de los
persas, nacido de la luz, y principio del bien. oromedonte: lUil. Uno
de los gigantes que quisieron escalar el cielo. Fué aplastado debajo
de una montafia de la isla de Cos á la cual dio su nombre.
ORONETA: f. Pesca. En las costas de Levante, tela de red de sesenta
ó más brazas de largo, con que pescan el pez volador. OROPASTES:
Biog. Mago famoso en el reinado de Cambises, rey de Persia. Este, á
quien Cambises había confiado la administración de los bienes de la
corona en la Media, se aprovechó de la larga ausencia del soberano
para volver el imperio al poder de los medos, sus compatriotas. Hizo
creer que su hermano Gamnata, que se parecía mucho á Esnierdis,
hermano del ley asesinado por Cambises, era el mismo Esnierdis, y
le sentó en el trono, obligando á todos á reconocerle como hijo de
Ciro. OROPELADAMENTE: adv. m. Con oropel. OROPELADOR, DORA:
adj. Que oropela. U. t. c. s. OROPELADURA: f. OrOPELAMIESTO.
OROPELAMIENTO: m. Acción ó efecto de oropelar. OROPELAR: a.
Adornar cou oropel. -Okofelar: fig. Aparentar, llenar de malicia y
ficción. Asi se veía la vaua y culpable creencia del pueblo, y cuáu
falsas y ouofeladas razoues les habían dado estos falsos pror-t;i.s. V.
Fb. Tomás Ramón. -Oropelarse: r. Gastar mucho oropel.
OROPELESCAMENTE: adv. m. CuorELADAME.NIE. OROPELESCO, CA:
adj. Que es todo apariencia. La llamada medida común del pecado...
exige no (aer en latiludinariaiiios punibles ui en rigorismos
ORüPlíLKSCOS. X*«* OROPESANO, NA: adj. Natural de Oropesa
(Toledo). U. t. c. s. II Perteneciente ó relativo á dicha población
espaQola. OROPOLI: Gcog. Municipio del dep. de El Paraíso. No
figura cntrL' lus municipios consignados en el censo de 1905, jiero lo
cita y describe la Ouia ¡le Honiliiras )iul>licada en ese mismo año por
el director general de Estadística. Estásit.sn el valle y á orillas del río
del mismo nombre, }• cieñe 1200 habils. Se fundó el nueblo en 1844
y en este mismo año fué incendiido por fuerzas del Gobierno de
aquella fecha, q ledando reducido á la condición do ahlea: en i8U:'i
se erigió de nuevo en pueblo, con su corresimndiente Municipalidad.
El 13 de junio do 1872 hubo en ejite |iucblo un ligero encuentro do
armas que sostuvo el capitán l'íu Montoya, do parto del Gobierno
legítimo, contni el f.'cneral .losé María Hapibona, jefe revolucionario,
quien tomó la plaza. Hay OEQU 4:1 en este nmnicipio dos fuentes
termales: la primera, que nace en la base oriental del cerro de La
Mesa y desemboca en el rio Choluteca; y la segunda, que naco en la
margen derecha del río San José y desemboca en la quebrada de Kl
Chino. OROSINO, NA: adj. Natural de Oroso (Coruña). U. t. c. s. ::
Perleuecicute ó relativo á dicha población esi>añola, OROTAVA:
Geog. El p. j. de este nombre, en la prov. de Canarias, tiene 1318
kms.' y 58412 habits. Sus 19 ayunt. comiirenden 4 v., 23 lagares, 46
aldeas,' 186 caseríos v 2643 edif. y albergues aislados. El ayunt. áe
Orotava tiene 9192 habita., de los que 3660 corresponden ala V. de
ese nombre, 406 al lugar de La Perdoma, 166 á la aldea de La
Florida, y el resto á 36 caseríos y á edif. y albergues diseminados.
OROTAVENSE: adj. Natural de Orotava (Canallas). U. t. c. s. c. ;
Perteneciente ó relativo á dicha población española. OROZCO (José):
Biog. Poeta hispanoamericano del siglo xviii. N. en Riobaml>a(hoy
Rep. del Ecuador) en 1725 é ingresó en la Compañía de Jesús en
1743. La obra que le ha valido cierto renombre es el poema épico La
conquista de Menorca, publicado por D. Juan León Mera en su
Ojeada hislórico-crítica sobre la poesía ecuatoriana; por D. Vicente E.
Molestina en la Lira Ecuatoriana, y, por último, por la Academia en la
Antología de Poetas Ecuatorianos. -Obozco y Berra (Fernando): Biog.
Novelista y poeta mejicano, n. en San Felipe del Obraje el 3 de junio
de 1822; m. en Méjico á principios de 1851. Era hermano del gran
historiador Manuel. Compartió el ejercicio de la medicina cou el
cultivo de las letras. Su novela La guerra de treinta años es la
historia de su vida. Su biógrafo el Sr. Altamirano nos lo presenta
como el poeta del dolor. «Sus canciones, dice, parecen moduladas
en el arpa de Byron ó en el laúd de Es¡ironccda. Era la éjioca en que
reinaba la escuela romántica, y nuestro poeta pertenecía á ella: pero
no por imitación, sino por vocación, poique sentía. No se nota en él
ese amaneramiento que caracteriza desde luego á los que siguen un
sistema cualquiera, no: cantaba el dolor, porque el dolor era su
numen, porque su alma, como una pitonisa desesiierada, era presa
de una agitación irresistible, y hablaba cediendo á un impulso
superior. Por su originalidad, por su profundo sentimiento, por su
fogosa y brillante imoginación, Fernando Orczco y Hcrra merece
ocupar uno de los primeros lugares en el templo de la literatura
mejicana.» * ORQUESTA: CON LA OR(}rE.STA X OTRA PARTE: expr.
fig. y fam. Con la misica á otka PARTE (V. en el lugar
correspondiente de la obra). Qne yo me río de todas, y de las dos
las primeras, y me vog, con su permiso, á otra parte con la on
452 ORSI -Obqttiocele: ant. Pato!. Nombre común de las
enfermedades del testículo y del escroto. (V. Sarcocele ea el tomo
correspondiente del DlCClONAIÍIO.) ORQUIOCOCO (del gr. órjis,
orjeSs, testículo, y kókkos, semilla, pepita): m. Bacterial. Bacteria
productora de la epididimitis blenorrágica. ORQUIODINIA (del gr.
órjis, orjeós, testículo, y odúné, dolor): f. I'atol. Sin. de Orquialgia (V.
en este mismo ArÉXDiOE). ORQUIOPEXIA (del gr. órjis, testículo, y
péxis, fijación): f. Cir. Operación cuyo objeto es fijar el testículo en
su sitio normal, en el escroto, y que se practica en los casos de
ectopía inguinal ó abdominal. ORQUIORRAFIA (del gr. órjis, orjeós,
testículo, y rafe, sutura): f. Cir. Sin. de Okqüiopexia {V. en este
mismo Apéndice). ORQUIOTERAPIA(dcl gr. órjis, orjeís, testículo, y
:erapeía, tratamiento): f. Terap. Empleo del extracto testicular, por el
método de BrovvnSeqnard. ORQUIOTOmIa (del gr. órjis, orjcós,
testículo, y tom¿, sección, corte): f. Cir. Ablación del testículo. II
Castración. ORQUIOTÓMICO, MlCA:adj. Perteneciente ó relativo á la
orquiotoniía. ORQUIOTOMO: m. Cir. Instrumento con que se practica
la orquiotomía. * ORQUITIS: Feter. En los animales domésticos es
casi siempre de origen traumático y procede de los golpes, de los
esfuerzos violentos y de la castración á vuelta ó pulgar. Sus
manifestaciones clínicas consisten en una tumefacción de los
testículos, muy dolorosa, con tensión anormal del escroto. El animal
tiene el lomo arqueado y sejiara, al andar, las extremidades
abdominales, para evitar su contacto con las bolsas. Suele haber
fiebre, pulso duro é inajmtencia. El tratamiento se reduce á la
aplicación de cocimientos calientes y de pomadas calmantes. Se
sostendrán los testículos con un vendaje apropiado, se administrará
un purgante no salino, y cuando los síntomas locales vayan
cediendo, se darán fricciones con pomada de belladona. No hay
inconveniente en practicar la sangría al principio de la enfermedad.
Si el testículo comienza á gangrenarse, se hará la castración por
torsión limitada. ORRE (EN): Mar. m. adv. A nriANEL. ORREGO LUCO
(Ll'I.s): Hiog. Escritor y político cliileuo contciujtoráneo, profesor de
derecho internacional en la universidad de Santiago. N. en 1S67.
Hizo sus estudios supei-iores en Suiza, en el Instituto Breidenstein, y
de regreso en Chile tomó activa parte en la guerra civil de 1891. Por
algún tiempo sirvió en la carrera diplomática y fué encargado de
Negocios en España y en el Brasil. Ha escrito, entre otras obras:
Pandereta (la literatura y la vida española contemporánea); Un
mundo muerto (la antigua Roma); la novela Un idilio nuevo, y
Episodios de la Independencia de Chile. ORROCISTO (del gr. 0)T(Í,9,
suero, y kúslis, vejiga): m. Patol. Quiste seroso. ORROQUECIA (del
gr. orrós, suero, y jédsein, evacuar el vientre): f. Patol. Diarrea
serosa. ORSÉLICO (Acil)o): Qubn. Compuesto que ejsec una vez la
función ácido y dos la de l'enol. eriva del tolueno y tiene por fórmula
OH3.C«H».[(OH)2.COOII]. Por la acción del calor pierde anhídrido
carbónico y desprende orcina. ORSI: Mit. El ser supremo, entre los
antiguos persas. -Orsi (.Jo.tlí Aoi'STÍN): Biog. Historiador y cardenal
italiano, n. en Florencia en 1692; ni. en Roma en 1761. Fué educado
en el colegio de los jesAiíta"), ingresando en la orden de Santo
Domingo en 1708. Dedicado & la enseñanza, explicó Filosofía y
Teología en el convento de San Marco», adquiriendo gran reputación
jior sus lecciones, así como ¡lor sus escritos. Llamado á Koina jior el
cardenal Neri Orsini en 1782, desempeñó allí algunos cargos
importantes, .siendo nombrado consultor de varías congregaciones y
ORTE maestro del Sacro Palacio. Clemente XIII le creó cardenal en
1759, dignidad que no fué parte para que el agraciado cambiase su
sencillez de vida y su afición al estudio. Su obra más importante fué
la Historia de la Iglesia, de la cual sólo pudo publicar los ¡irimeros
veinte tomos ó volúmenes, hasta el año 600. Esta obra fué
completada después por Bachetti y consta de cincuenta volúmenes,
-Orsi (Pablo): Biog. Arqueólogo italiano, n. en Rovereto en 1859. Es
profesor de Arqueología en la universidad de Catania, director del
Museo arqueológico y de excavaciones de las provincias de
Caltanissetta, Catania y Siracusa, correspondiente de la Academia de
los Linces, y autor de gran número de trabajos descriptivos de
monumentos y antigüedades de Italia y de algunas obras históricas,
tal como Episodi di guerra alpina r.ella campagna vcnelo-iirolese del
1847, desunti da documenti inedili, ORSÍLOCO: Biog. Hijo de
Idomeneo, rey de Creta, siguió á su padre al sitio de Troya, donde se
distinguió por su valor y su ligereza en la carrera; pero habiendo
querido oponerse á que Ulises obtuviera parte en el botín, éste le
armó una emboscada y le atravesó con una pica. Esta hazaña la
refiere el mismo Ulises ásu vuelta á Itaca, cuando pretende pasar
por cretense. ORSINI: Uist. Poderosa familia italiana del siglo XV,
duefia de verdaderos principados que les habían sido confiados por
los papas como feudo. Con la decadencia del papado se declararon
indeiieudientes y señores hereditarios de los distritos que
gobernaban. -Orsini (Félix): Biog. Revolucionario italiano, n. en
Meldola en 1819; m. en París en 1858. Estudió la carrera de Derecho
en Bolonia; estuvo afiliado al partido radical y tomó parte en la
revolución de la Ronjaña, por lo que fué preso; una vez libre, le
expulsaron de Toscana. Luego combatió por la defensa de Venecia, y
sus nuevas tentativas revolucionarias fracasaron, por lo que volvió á
ser preso en 1855 y condenado á muerte. Logró escaparse y
marchar á Inglaterra y luego á París, donde, en 14 de enero de
1858, intentó asesinar á Napoleón III, cuando se dirigía al teatro de
la Opera, arrojando á su paso bombas que mataron é hirieron á
ciento cincuenta y seis personas. Fué condenado á muerte en unión
de sus cómplices Pieriy Rudio. Dejó escritas algunas obras, de las
que recordamos: Memorias politicas, y Las prisiones de Austria y de
Italia. ORTEGA (Francisco de): Biog. Capitán español del siglo xvii,
que tomó parte en las entradas que se hacían en California. Según el
señor Orozco y Berra, Ortega, con licencia del virrey D. Rodrigo
Pacheco, se hizo á la vela en marzo de 1632, llevando en su
pequeño buque un sacerdote llamado Diego de Nava, nombrado
vicario de la península; el 2 de mayo tomó tierra, recorriendo la
costa desde la bahía de San Bernabé hasta el puerto de la Paz, y sin
tentar el establecimiento, pero sí rescatando perlas, se volvió á
Sinaloa en junio del mismo año, Siem))re con licencia del virrey,
volvió Ortega á emprender viajes en 1633 y 1634, con el mismo mal
éxito para fundar, aunque con ventaja de sus propios intereses. -
Orteoa Martínez (Jo.sé M.»): Biog. Político y literato venezolano. N.
cu San Felipe el Fuerte el 1.° de julio de 1822. Hizo toda la campaña
federal en la guerra de los Cinco años, en la cual se distinguió
brillantemente, y después ocupó puestos de importancia en lus
armas y en la política. Sus versos están dentro de la corriente
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like