The blog gives you idea of testing and automation testing example of selenium webdriver,SQl and Jmeter, you see the basic example of selenium web driver and get idea how to do automation testing,

Mover Slider From one position to other

I have a web application which have a slider, when I click or drag pointer on slider then below displayed data should changed. user can move slider to specific point eg: 2, 6, 8 and 10 Days.
I can drap slider at 2 days then data of 2 day displayed in below table.

I write code for that slider, it is very simple and under stable. you can choose "postionOfSlider" value should be any.


public static void dragdrop(){
     int postionOfSlider=10;
        WebElement slider = driver.findElement(By.id("dragdrop"));  // Position of element
        int width=slider.getSize().getWidth();   // Width of Slider or element
        Actions move = new Actions(driver);
        move.moveToElement(slider, ((width*postionOfSlider)/100), 0).click();
         // move to a specific point on the dragpoint
       move.build().perform();
       System.out.println("Slider moved");

      }

we can also used for-loop to drag slider or move slider from one point to another point on the webpage with the help of above code.

How to open Different Browser though selenium webdriver.

if you are new in selenium webdriver and you want to learn basic about selenium webdriver.
Like how to open browser(IE, Chrome, FF), please refer below code.

1) you can download selenium jar file, from this  link.
2) create a project in ecplise
3)Import jar file in your project.

public class openBrowser{

public static void main(String[] args)
{
Webdriver driver = new FirefoxDriver();
                  driver.get("www.google.co.in");

}

}

above code could open Firefor browser and google webpage open


Open CHROME browser :
1) you can download chrome browser driver from here
2) copy location of chrome browser and past in below code under system property attribute

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class chromebrowser
              {
public static void main(String args[])
{
      System.setProperty("webdriver.chrome.driver", "d://chromedriver.exe (path of your chromedriver)");
               WebDriver driver=new ChromeDriver();
driver.get("www.google.co.in");
       }
}

same code for IE browser but for IE you have to download IE driver and in above code paste location of IE browser.
Powered by Blogger.