Selenium Automation Testing

Selenium Automation Testing Selenium is a suite of tools for browser automation (i.e. automated Web testing). It is composed ofSelenium IDE: A tool for recording and playing back. T..

About Selenium

Selenium is a software testing framework for the web that facilitates the automation of browsers. The Selenium project produces various tools for automation testing such as Selenium IDE, Selenium Remote Control (RC), Selenium Grid and Selenium 2.0 & WebDriver. Learning all the tools will give you many different options for approaching different automation problems. The entire suits

of tools result in a rich set of testing functions specially geared to the needs of testing of web application of all types. Why Selenium

– Selenium is an open source tool with Corporate backing.
– The tests can then be run against most modern web browsers.
– Selenium deploys on Windows, Linux, and Macintosh platforms.
– It allows recording, editing, and debugging tests.
– Recorded tests can be exported in most language e.g. html, Java, .net, perl, ruby etc.
– Selenium has the support of some of the largest browser vendors who have taken (or are taking) steps to make Selenium a native part of their browser. Selenium Components

– Selenium 1/ Selenium RC or Remote Control: Selenium RC was the main Selenium project for a long time before the Selenium Webdriver merge brought up Selenium 2, the newest and more powerful tool.
– Selenium IDE (Integrated Development Environment): The Selenium IDE is a simple but powerful Firefox extension that lets users record and replay sets of browser interactions as test cases.
– Selenium Grid: Selenium Grid is a server that allows tests to use web browser instances running on remote machines. It allows the Selenium RC solution to scale for large test suites and for test suits that must be run in multiple environments. Different tests can be run at the same time on different remote machines.
– Selenium Web Driver : It also provides a test domain-specific language (Selenese/Webdriver) to write tests in a number of popular programming languages, including Java, C #, Groovy, Perl, PHP, Python and Ruby. It is the newest addition to the Selenium toolkit. This provides all sort of awesome features, including a more cohesive and object oriented API as well as an answer to the limitation of the old implementation. Selenium WebDriver

The primary new feature in Selenium 2.0 is the integration of the WebDriver API. WebDriver is designed to provide a simpler, more concise programming interface in addition to addressing some limitations in the Selenium-RC API. It enables you to use a programming language to write test scripts in different programming languages like html, Java, .net , perl, ruby and which enables you to use conditional operations, looping and other programming concepts which makes you test script robust. Selenium-WebDriver was developed to better support dynamic web pages where elements of a page may change without the page itself being reloaded. WebDriver’s goal is to supply a well-designed object-oriented API that provides improved support for modern advanced web-app testing problems.

http://seleniumwebdriver.org/new-features-in-java-1-8
16/03/2018

http://seleniumwebdriver.org/new-features-in-java-1-8

New features in Java 1.8 : 1. Lambda Expression 2. Functional Interface 3. Default method in interface 4. Static method in interface 5. Predicate (Predefined Interface) 6. Function (Predefined Interface) 7. Consumer (Predefined Interface) 8. Supplier (Predefined Interface) 9.

http://seleniumwebdriver.org/static-class-in-java
23/02/2018

http://seleniumwebdriver.org/static-class-in-java

Can a class be static in Java ? The answer is YES, we can have static class in java. In java, we have static instance variables as well as static methods and also static block. Classes can also be made static in Java. Java allows us to define a class within another class.

http://seleniumwebdriver.org/instance-initializer-block-in-javaInstance initialization block code runs right after the c...
14/02/2018

http://seleniumwebdriver.org/instance-initializer-block-in-java

Instance initialization block code runs right after the call to super() in a constructor, in other words, after all super constructors have run. The order in which initialization blocks appear in a class matters. If a class has more than one they all run in the order they appear in the class file.
Some rules to remember:
Initialization blocks execute in the order they appear.
Static Initialization blocks run once when the class is first loaded.
Instance Initialization blocks run every time a class instance is created.
Instance Initialization blocks run after the constructor’s call to super().

Apart from methods and constructors, Initialization Blocks are the third place in a Java Program where operations can be performed. Initialization Blocks come in two flavors: Static Initialization Blocks: Runs first when the class is first loaded.

07/02/2018

Assert
We use Assert when we have to validate critical functionality, failing of which makes the ex*****on of further statements irrelevant. Hence, the test method is aborted as soon as failure occurs.
Example-


public void assertionTest(){

//Assertion Passing
Assert.assertTrue(1+2 == 3);
System.out.println("Passing 1");

//Assertion failing
Assert.fail("Failing second assertion");
System.out.println("Failing 2");
}

http://seleniumwebdriver.org/difference-between-assert-and-verify

Selenium is a suite of tools for browser automation (i.e. automated Web testing). It is composed ofSelenium IDE: A tool for recording and playing back. T..

http://seleniumwebdriver.org/what-is-java-static-import
04/02/2018

http://seleniumwebdriver.org/what-is-java-static-import

By using static imports, we can import the static members from a class rather than the classes from a given package. For example, Thread class has static sleep method, below example gives an idea: import static java.lang.

http://seleniumwebdriver.org/print-table-data-using-selenium-webdriverpackage scripts;                            import...
29/01/2018

http://seleniumwebdriver.org/print-table-data-using-selenium-webdriver
package scripts;

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

public class printTableData {

public static void main(String[] args)
throws InterruptedException {

//set GeckoDriver path for FireFox browser
System.setProperty("webdriver.gecko.driver",
"C:\\selenium\\geckodriver-v0.10.0-win64\\geckodriver.exe");

//Create Browser object
WebDriver driver=new FirefoxDriver();

//open URL
driver.get("http://www.seleniumwebdriver.org/");

//maximize the window
driver.manage().window().maximize();

//login to test web site
driver.findElement(By.id("remail")).sendKeys
("[email protected] ");
driver.findElement(By.id("rpassword")).
sendKeys("test@123");
driver.findElement(By.id("rsubmit")).click();

Thread.sleep(3000);

//Get Row Count
int rowCount=driver.findElements(By.
tagName("tr")).size();

//Get Column Count
int colCount=driver.findElements
(By.xpath("//thead//th")).size();

System.out.println("Row count :" + rowCount);
System.out.println("Col count :" + colCount);

//Print table Data

for(WebElement tdata:driver.findElements
(By.tagName("tr")))
{
System.out.println(tdata.getText());
}
}

}

We can find every web element using its tag name. table has tr tag for row. In Selenium WebDriver we can use driver.findElements(By.tagName(tr) to find all rows data. Check below image and Selenium code for the same: package scripts; import org.openqa.selenium.By; import org.openqa.selenium.WebDrive...

17/01/2018

http://seleniumwebdriver.org/what-is-the-difference-between-put-post-and-patch

POST HTTP.POST can be used when the client is sending data to the server and the server will decide the URI for the newly created resource. The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Req.....

Address

BTM
Bangalore
560078

Alerts

Be the first to know and let us send you an email when Selenium Automation Testing posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Contact The Business

Send a message to Selenium Automation Testing:

Share