• Complain

Zhan - Selenium webdriver recipes in c♯

Here you can read online Zhan - Selenium webdriver recipes in c♯ full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. City: Berkeley;CA, year: 2016, publisher: Apress, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Zhan Selenium webdriver recipes in c♯
  • Book:
    Selenium webdriver recipes in c♯
  • Author:
  • Publisher:
    Apress
  • Genre:
  • Year:
    2016
  • City:
    Berkeley;CA
  • Rating:
    5 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 100
    • 1
    • 2
    • 3
    • 4
    • 5

Selenium webdriver recipes in c♯: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Selenium webdriver recipes in c♯" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Zhan: author's other books


Who wrote Selenium webdriver recipes in c♯? Find out the surname, the name of the author of the book and a list of all author's works by series.

Selenium webdriver recipes in c♯ — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Selenium webdriver recipes in c♯" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Zhimin Zhan 2015
Zhimin Zhan Selenium WebDriver Recipes in C# 10.1007/978-1-4842-1742-9_1
1. Introduction
Zhimin Zhan 1
(1)
Belconnen, Australia
Electronic supplementary material
The online version of this chapter (doi: 10.1007/978-1-4842-1742-9_1 ) contains supplementary material, which is available to authorized users.
Selenium WebDriver is a free and open source library for automated testing web applications. I assume that you have had some knowledge of Selenium WebDriver, based on the fact that you picked up this book (or opened it in your eBook reader).
Selenium was originally created in 2004 by Jason Huggins, who was later joined by his other ThoughtWorks colleagues. Selenium supports all major browsers and tests can be written in many programming languages and run on Windows, Linux, and Macintosh platforms.
Selenium 2 is merged with another test framework WebDriver (thats why you see selenium-webdriver) led by Simon Stewart at Google (he now works at Facebook), and Selenium 2.0 was released in July 2011. I use the names Selenium, WebDriver, and Selenium WebDriver interchangeably in this book.
Selenium Language Bindings
Selenium tests can be written in multiple programming languages such as Java, C#, Python, and Ruby (the core ones). All examplesin this book are written in Selenium with C# binding. As you will see in the examples that follow, the use of Selenium in different bindings is very similar. Once you master one, you can apply it to others quite easily. Take a look at a simple Selenium test script in four different language bindings: C#, Java, Python, and Ruby.
C#
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;
class GoogleSearch
{
static void Main()
{
// Create a new instance of the driver
// Notice that the remainder of the code relies on the interface,
// not the implementation.
IWebDriver driver = new FirefoxDriver();
// And now use this to visit Google
driver.Navigate().GoToUrl(" http://www.google.com ");
// Find the text input element by its name
IWebElement query = driver.FindElement(By.Name("q"));
// Enter something to search for
query.SendKeys("Hello Selenium WebDriver!");
// Submit the form based on an element in the form
query.Submit();
// Check the title of the page
Console.WriteLine(driver.Title);
}
}
Java
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) {
WebDriver driver = new FirefoxDriver();
driver.get(" http://www.google.com ");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("Hello Selenium WebDriver!");
element.submit();
System.out.println("Page title is: " + driver.getTitle());
}
}
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)
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
Set up the Development Environment
Most C# programmers develop C# code in Microsoft Visual Studio. I use Visual Studio Community 2015 as the integrated development environment (IDE) of choice for this book, as it is free.
Prerequisites
  • Download and install Visual Studio Community 2015.
  • Make sure your target browser is installed, such as Chrome or Firefox.
Set up Visual Studio Solution
Create a new project in Visual Studio.
Select Templates Visual C# Test Unit Test Project, as shown in Figure .
Figure 1-1 Selecting a template for a new Visual Studio project You will - photo 1
Figure 1-1.
Selecting a template for a new Visual Studio project
You will see the project skeleton created, as shown in Figure .
Figure 1-2 Skeleton for a new project Add the Selenium WebDriver - photo 2
Figure 1-2.
Skeleton for a new project
Add the Selenium WebDriver package to the project.
Run the following command in the Package Manager Console (select Tools NuGet Package Manager Package Manager Console; see Figure ):
Figure 1-3 Adding a package to a project PMgt Install-Package - photo 3Figure 1-3 Adding a package to a project PMgt Install-Package - photo 4
Figure 1-3.
Adding a package to a project
PM> Install-Package Selenium.WebDriver
Also install Selenium.Support, which includes helper .NET classes for the Selenium WebDriver application programming interface (API), using this command:
PM> Install-Package Selenium.Support
Figure shows what looks like in Visual Studio Solution Explorer after Selenium WebDriver is installed.
Figure 1-4 Selenium WebDriver installed in Visual Studio Solution Explorer - photo 5
Figure 1-4.
Selenium WebDriver installed in Visual Studio Solution Explorer
Create a test and run it
Add a new C# class (a test).
Essentially a Selenium test in C# is a C# class. Right-click the project name in Solution Explorer, then select Add Unit Test, as shown in Figure .
Figure 1-5 Adding a unit test A new unit test file is created named - photo 6
Figure 1-5.
Adding a unit test
A new unit test file is created (named UnitTest1.cs or UnitTest2.cs if UnitTest1.cs already exists). Rename it (press F2 and enter a name in camel case, such as GoogleSearchTest ), as shown in Figure .
Figure 1-6 Renaming the new unit test file Create a test case For - photo 7
Figure 1-6.
Renaming the new unit test file
Create a test case.
For simplicity, paste a Google Search test case script into the editor, similar to the one shown in Figure .
Figure 1-7 Creating a test case The several red underlines like the one - photo 8
Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Selenium webdriver recipes in c♯»

Look at similar books to Selenium webdriver recipes in c♯. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Selenium webdriver recipes in c♯»

Discussion, reviews of the book Selenium webdriver recipes in c♯ and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.