Zhan | Selenium WebDriver Recipes in C# | E-Book | www2.sack.de
E-Book

E-Book, Englisch, 171 Seiten

Zhan Selenium WebDriver Recipes in C#

Second Edition
2. ed
ISBN: 978-1-4842-1742-9
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark

Second Edition

E-Book, Englisch, 171 Seiten

ISBN: 978-1-4842-1742-9
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark



A quick practical problem-solving guide to automated testing web applications with Selenium WebDriver in C#. Selenium WebDriver Recipes in C#, Second Edition contains hundreds of solutions to real-world problems, with clear explanations and ready-to-run Selenium test scripts that you can use in your own projects.
What You'll LearnHow to locate web elements and test functions for hyperlinks, buttons, TestFields and TextAreas, Radio Buttons, CheckBox, and more
How to use Selenium WebDriver for select lists, navigation, assertions, frames, file upload and pop-up dialogs
How to debug test scripts and test data
How to manage and deal with browser profiles and capabilities
How to manage tests for advanced User Interactions and Experiences (UX)
How to work with and manage tests and testing using the Selenium Remote Control Server

AudienceThis book is for experienced .NET and C# Windows application programmers/developers.




Zhimin Zhan is the founder and Continuous Integration Officer of AgileWay Pty Ltd, Australia. As an advisor and coach, he helps organzations by implementing test automation with Continuous Integration using open technologies such as Selenium WebDriver and Watir. Zhimin is the creator of TestWise, the next-generation functional testing tool that supports functional test refactorings, a frequent speaker and writer. He shares his test automation and CI experience at testwisely-dot-com.

Zhan Selenium WebDriver Recipes in C# jetzt bestellen!

Autoren/Hrsg.


Weitere Infos & Material


1;Contents at a Glance;5
2;Contents;7
3;About the Author;17
4;About the Technical Reviewer;18
5;Acknowledgments;19
6;Preface;20
7;Chapter 1: Introduction;22
7.1; Selenium Language Bindings;22
7.2; Set up the Development Environment;24
7.2.1; Prerequisites;24
7.2.2; Set up Visual Studio Solution;24
7.2.3; Create a test and run it;27
7.3; Cross-Browser Testing;30
7.3.1; Firefox;30
7.3.2; Chrome;30
7.3.3; Internet Explorer;31
7.3.4; Edge;33
7.4; Visual Studio Unit Testing Framework;33
7.4.1; Visual Studio Unit Testing Framework Fixtures;35
7.4.2; Alternative Framework NUnit;36
7.5; Run Recipe Scripts;36
7.5.1; Run Tests in Visual Studio;36
7.5.1.1;Find the Test Case;36
7.5.1.2;Run Individual Test Case;37
7.5.1.3;Run all Test Cases in a Test Script File;38
7.5.1.4;Run all Tests;38
7.5.2; Run Tests from the Command Line;39
8;Chapter 2: Locating Web Elements;41
8.1; Start browser;41
8.2; Find element by ID;42
8.3; Find element by Name;42
8.4; Find element by Link Text;42
8.5; Find element by Partial Link Text;42
8.6; Find element by XPath;43
8.7; Find element by Tag Name;44
8.8; Find element by Class;44
8.9; Find element by CSS Selector;45
8.10; Chain FindElement to find child elements;45
8.11; Find multiple elements;45
9;Chapter 3: Hyperlink;46
9.1; Click a link by text;46
9.2; Click a link by ID;46
9.3; Click a link by partial text;47
9.4; Click a link by XPath;47
9.5; Click nth link with exact same label;48
9.6; Click nth link by CSS selector;48
9.7; Verify that a link is present or not;48
9.8; Getting link data attributes;49
9.9; Test links open a new browser window;49
10;Chapter 4: Button;50
10.1; Click a button by text;50
10.2; Click a form button by text;51
10.3; Submit a form;51
10.4; Click a button by ID;52
10.5; Click a button by name;52
10.6; Click an image button;52
10.7; Click a button via JavaScript;52
10.8; Assert a button present;53
10.9; Assert a button enabled or disabled;53
11;Chapter 5: TextField and TextArea;54
11.1; Enter Text into a Text Field by Name;54
11.2; Enter Text into a Text Field by ID;54
11.3; Enter Text into a Password Field;55
11.4; Clear a Text Field;55
11.5; Enter Text into a Multiline Text Area;55
11.6; Assert Value;55
11.7; Focus on a Control;55
11.8; Set a Value to a Read-only or Disabled Text Field;56
11.9; Set and assert the value of a hidden field;56
12;Chapter 6: Radio Button;57
12.1; Select a Radio Button;57
12.2; Clear Radio Option Selection;58
12.3; Assert a Radio Option is Selected;58
12.4; Iterate Radio Buttons in a Radio Group;59
12.5; Click nth Radio Button in a Group;59
12.6; Click Radio Button by the Following Label;59
12.7; Customized Radio Buttons: iCheck;60
13;Chapter 7: Check Box;62
13.1;Check by name;62
13.2;Check by ID;62
13.3; Clear a check box;63
13.4; Assert a check box is checked (or not);63
13.5;Chain FindElement to find child elements;63
13.6;Customized Check Boxes: iCheck;64
14;Chapter 8: Select List;65
14.1;Select an option by text;65
14.2;Select an option by value;66
14.3;Select an option by index;66
14.4;Select an option by iterating all options;66
14.5;Select multiple options;67
14.6; Clear one selection;67
14.7;Clear all selections;68
14.8;Assert selected option;68
14.9;Assert the value of a select list;68
14.10; Assert multiple selections;68
15;Chapter 9: Navigation and Browser;69
15.1;Go to a URL;69
15.2;Visit pages within a site;69
15.3;Perform actions from the right-click context menu;70
15.4;Open browser in certain size;70
15.5; Maximize browser window;70
15.6; Move browser window;70
15.7;Minimize browser window;71
15.8;Scroll focus to control;71
15.9;Switch between browser windows or tabs;71
15.10; Remember current web page URL and return to it later;72
16;Chapter 10: Assertion;73
16.1;Assert page title;73
16.2; Assert page text;73
16.3;Assert page source;74
16.4;Assert checkbox selected;74
16.5;Assert button enabled;74
16.6; Assert label text;74
16.7;Assert span text;75
16.8; Assert div text or HTML;75
16.9;Assert table text;76
16.10; Assert text in a table cell;76
16.11;Assert text in a table row;77
16.12;Assert image present;77
17;Chapter 11: Frames;78
17.1; Testing Frames;78
17.2; Testing iframe;79
17.3; Test multiple iframes;80
18;Chapter 12: AJAX;81
18.1; Wait within a time frame;82
18.2; Explicit waits until time out;82
18.3; Implicit waits until time out;82
18.4; Wait AJAX call to complete using JQuery;83
19;Chapter 13: Pop-up;84
19.1; File upload;84
19.2; JavaScript pop-ups;85
19.3; Modal style dialog boxes;86
19.4; Timeout on a test;86
19.5; Pop-up handler approach;87
19.6; Basic or Proxy Authentication dialog box;90
19.7; Internet Explorer modal dialog box;91
20;Chapter 14: Debugging Test Scripts;92
20.1; Print text for debugging;92
20.2; Write page source or element HTML into a file;92
20.3; Take a screenshot;93
20.4; Leave the browser open after test finishes;93
20.5; Debug test execution using Debugger;94
20.5.1; Enable breakpoints;94
20.5.2; Execute one test case in debugging mode;95
20.5.3; Step over test execution;95
21;Chapter 15: Test Data;96
21.1; Get date dynamically;96
21.2; Get a random boolean value;97
21.3; Generate a number within a range;98
21.4; Get a random character;99
21.5; Get a random string at fixed length;99
21.6; Get a random string in a collection;99
21.7; Generate a test file at fixed sizes;100
21.8; Retrieve data from database;100
22;Chapter 16: Browser Profile;102
22.1; Get browser type and version;102
22.2; Set HTTP proxy for browser;103
22.3; Verify file download in Chrome;103
22.4; Ve rify file download in Firefox;103
22.5; Bypass basic authentication by embedding username and password in URL;104
22.6; Bypass basic authentication with Firefox AutoAuth plug-in;105
22.7; Manage cookies;108
22.8; Headless browser testing with PhantomJS;108
22.9; Test responsive web sites;109
23;Chapter 17: Advanced User Interactions;110
23.1; Double-click a control;111
23.2; Move mouse to a control: Mouse over;111
23.3; Click and hold: Select multiple items;111
23.4; Context click: Right-click a control;112
23.5; Drag-and-drop;112
23.6; Drag slider;113
23.7; Send key sequences: Select All and Delete;114
24;Chapter 18: HTML5 and JavaScript;115
24.1; HTML5 email type field;115
24.2; HTML5 time field;116
24.3; Invoke ‘onclick’ JavaScript event;117
24.4; Invoke JavaScript events such as onchange;117
24.5; Scroll to the bottom of a page;118
24.6; Chosen: Standard select;118
24.6.1; Chosen: Multiple select;120
24.7; AngularJS web pages;124
24.8; Ember JS web pages;126
25;Chapter 19: WYSIWYG Editor;128
25.1;TinyMCE;128
25.2;CKEditor;129
25.3;SummerNote;130
25.4;CodeMirror;131
26;Chapter 20: Leverage Programming;132
26.1; Throw exceptions to fail test;132
26.1.1; Flag incomplete tests;133
26.1.2; Stop test execution during debugging a test;133
26.2; Ignorable test statement error;133
26.3; Read external file;134
26.4; Data-driven tests with Excel;134
26.5; Data-driven tests with CSV;137
26.6; Identify element IDs with dynamically generated long prefixes;138
26.7; Sending special keys such as Enter to an element or browser;139
26.8; Use of Unicode in test scripts;139
26.9; Extract a group of dynamic data: Verify search results in order;139
26.10; Verify uniqueness of a set of data;141
26.11; Extract dynamic visible data rows from a results table;141
26.12; Extract dynamic text following a pattern using Regex;143
27;Chapter 21: Optimization;145
27.1; Assert string in page_source is faster than the text;145
27.2; Getting text from more specific elements is faster;146
27.3; Avoid programming if-else block code if possible;146
27.4; Use variable to cache unchanged data;147
27.5; Enter large text into a text box;147
27.6; Use environment variables to change test behaviors dynamically;148
27.7; Test a web app in two languages;149
27.8; Multi-language testing with lookups;150
28;Chapter 22: Gotchas;153
28.1; Test starts browser but no execution with blank screen;153
28.2; Be aware of browser and driver changes;154
28.3; Failed to assert copied text in browser;154
28.4; The same test works for Chrome, but not for Internet Explorer;155
28.5; “Unexpected tag name ‘input’”;156
28.6; Element is not clickable or not visible;157
29;Chapter 23: Remote Control Server;158
29.1; Selenium Server installation;158
29.2; Execute tests in the specified browser on another machine;159
29.3; Selenium Grid;160
29.3.1; Start the hub;160
29.3.2; Start the nodes;161
29.3.3; Using Grid to run tests;161
29.3.4; Concerns with Selenium Grid;161
30;Chapter 24: Afterword;164
30.1; Practice makes perfect;164
30.1.1; Write tests;164
30.1.2; Improve programming skills;165
30.2; Successful test automation;165
30.2.1; Maintain test scripts to keep up with application changes;165
30.2.2; Shorten test execution time to get quick feedback;166
31;Chapter 25: Resources;167
31.1; Books;167
31.2; Web sites;167
31.3; Tools;167
32;Index;168



Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.