Tuesday, 23 June 2015

What is Selenium


Selenium is the most searched words on google these days in QA area. If we talk about testing automation Selenium would be first preference. Selenium has many benefits over other automation tools like QTP. Reasons for Selenium popularity can be categorized under below points:

  1. Selenium is open source.
  2. Selenium is supported by Google
  3. Very big and effective Selenium Community which is managing Selenium releases
  4. Selenium supports java, C#, Ruby, Python, javascript Node)
  5. Selenium script can automate browsers like       Firefox, Chrome, Internet Explorer, Safari, Opera, HTML Unit
  6. Multiple OS supported Microsoft Windows, Apple OS, Linux
  7. Appium built on top of Selenium. If you know        Selenium, you can automate application easily with Appium
  8. Best part of open source tool is, it integrates     with other open source tools very efficiently eg  Jenkins, Sauce Labs.




Video will describe what is Selenium, why we need to learn Selenium and what versions of Selenium available in market.

                               

Install Apk

Install Apk


Video will show to install .apk file in Mobile and also different ways for getting .apk file. Video will also cover how you can transfer you .apk file between your computer and mobile



Appium WhatsApp

Appium WhatsApp



Video will show how you can launch WhatsApp using Appium and Selenium WebDriver



Appium Example Calling Number

Appium Example Calling Number


Video will show hou you can call any number from your mobile using Appium and Selenium WebDriver





import java.net.MalformedURLException;
import java.net.URL;

import io.appium.java_client.android.AndroidDriver;

import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;


public class CallingNumber {

AndroidDriver dr;
@Test
public void call() throws MalformedURLException{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "Moto G");
capabilities.setCapability("platformVersion", "5.0.2");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("appPackage", "com.android.dialer");
capabilities.setCapability("appActivity", "com.android.dialer.DialtactsActivity");

dr = new AndroidDriver(new URL("http://192.168.1.3:4723/wd/hub"), capabilities);
dr.findElement(By.id("com.android.dialer:id/floating_action_button")).click();
//Dial a number
dr.findElement(By.id("com.android.dialer:id/one")).click();
dr.findElement(By.id("com.android.dialer:id/one")).click();
dr.findElement(By.id("com.android.dialer:id/one")).click();
//Dialing a number
dr.findElement(By.id("com.android.dialer:id/dialpad_floating_action_button")).click();
}
}




Appium App Package Activity


Appium App Package Activity




Video will tell how to get Application App Activity name and App Package Name.


Selenium TestNg

Selenium WebDriver TestNg



Video will tell what is TestNg, why we need TestNg, how can we intsall/configure TestNg in Selenium WebDriver







Selenium Dynamic Xpath

Selenium WebDriver Dynamic Xpath

Video will describe
how we can handle dynamic Xpath is Selenium WebDriver








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


public class DynamicXpath {

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

WebDriver driver = new FirefoxDriver();
driver.get("http://yahoo.com");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

driver.findElement(By.xpath("//*   [@id='UHSearchBox']")).sendKeys("Selenium");
 
 Thread.sleep(5000);

//List<WebElement> list = driver.findElements(By.xpath("//*[starts-
  with(@id,'yui_3_12_0_1_1430')]/a"));

 List<WebElement> list = driver.findElements(By.xpath("//*
 [contains(@id,'ui_3_12_0_1_1430')]/a"));

System.out.println(list.size());

list.get(0).click();

}

}