Tuesday, 2 February 2016

FILLO SELENIUM@Data driven testing framework(Set table starting row and column)

Set table starting row and column:
==========================

Syntax:
========

//Table start row
System.setProperty("ROW", "rownumber");

////Table start column
System.setProperty("COLUMN", "columnnumber");


//Example on Set table starting row and column

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

// Now set table start row and column

// Table start row
System.setProperty("ROW", "1");

// Table start column
System.setProperty("COLUMN", "4");

Fillo fillo = new Fillo();
Connection connection = fillo.getConnection("C:\\Ramesh\\Test.xlsx");

// with where method
Recordset recordset = connection.executeQuery("Select * from Sheet1")
.where("Name=Ramesh").where("Course='Selenium'");

connection.close();

}
}



FILLO SELENIUM@Data driven testing framework(WHERE METHOD)

FILLO:WHERE METHOD:
=====================

Syntax:
======
Recordset recordset=connection.executeQuery("Select * from Sheet1").where("COLUMN=VALUE").where("COLUMN=VALUE'");


//Example on where method in fillo

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



Fillo fillo=new Fillo();
Connection connection=fillo.getConnection("C:\\Ramesh\\Test.xlsx");


//with  where method
Recordset recordset=connection.executeQuery("Select * from Sheet1").where("Name=Ramesh").where("Course='Selenium'");

connection.close();
}
}

FILLO SELENIUM@Data driven testing framework(mULTIPLE where CONDITIONS)

FILLO::MULTIPLE WHERE CONDITION IN FILLO:
========================================
Syntax:
=====
Recordset recordset=connection.executeQuery("Select * from Sheet1 where column1=value1 and column2=value2 and column3=value3 and column4=value4");


//Example

public class Filo_Update
{
public static void main(String[] args) throws InterruptedException 
{
Fillo fillo=new Fillo();
Connection connection=fillo.getConnection("C:\\Ramesh\\Test.xlsx");
String strQuery="INSERT INTO Sheet1(Name,Course) VALUES('RAMESH','SELENIUM WITH JAVA')";

//with multiple where conditions
Recordset recordset=connection.executeQuery("Select * from Sheet1 where column1=value1 and column2=value2 and column3=value3");

Recordset recordset=connection.executeQuery("Select * from Sheet1 where Name=Ramesh and Course=SELENIUM WITH JAVA and ID=3");
connection.close();
}
}


FILLO SELENIUM@Data driven testing framework(insert)


INSERT IN SQL:
=============
SYNTAX:
========
INSERT INTO TABLE_NAME (column1, column2, column3,...columnN)]
VALUES (value1, value2, value3,...valueN);

Here, column1, column2,...columnN are the names of the columns in the table into which you want to insert data.


//EXAMPLE INSERT COMMAND

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

Fillo fillo=new Fillo();
Connection connection=fillo.getConnection("C:\\Ramesh\\Test.xlsx");
String strQuery="INSERT INTO Sheet1(Name,Course) VALUES('RAMESH','SELENIUM WITH JAVA')";

connection.executeUpdate(strQuery);

connection.close();
}
}

Monday, 1 February 2016

FILLO SELENIUM@Data driven testing framework(update)

Fillo is an Excel API for Java and you can query xls & xlsx files

It supports DDL,DML AND DCL COMMANDS


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

Fillo fillo=new Fillo();
Connection connection=fillo.getConnection("C:\\Ramesh\\TestData.xlsx");
String strQuery="Update Sheet1 Set Course='selenium' where name='Ramesh'";

connection.executeUpdate(strQuery);

connection.close();
}
}

FILLO SELENIUM@Data driven testing framework(select)

Fillo is an Excel API for Java and you can query xls & xlsx files. 
It supports DDL , DML AND DCL commands over SQL.

SELECT SQL:
===========

Syntax:

SELECT column1, column2, columnN FROM table_name;



USING SELECT:
=============
public class Filo_Select {
public static void main(String[] args) throws InterruptedException {

Fillo fillo=new Fillo();
Connection connection=fillo.getConnection("C:\\RAMESH\\TestdATA.xlsx");
String strQuery="Select * from Sheet1 where name='Ramesh'";
Recordset recordset=connection.executeQuery(strQuery);

while(recordset.next()){
System.out.println(recordset.getField("Details"));
}

recordset.close();
connection.close();
}

}

Handling iframes in selenium

Basically, we can switch over the elements in frames using 3 ways.

By Index
By Name or Id
By Web Element
Switch to the frame by index:

Index is one of the attributes for the Iframe through which we can switch to it.

Index of the iframe starts with '0'.

Suppose if there are 100 frames in page, we can switch to the iframe by using index.

driver.switchTo().frame(0);
driver.switchTo().frame(1);
Switch to the frame by Name or ID:

Name and ID are attributes of iframe through which we can switch to the it.

driver.switchTo().frame("iframe1");
driver.switchTo().frame("id if the element");
Example of Switching to iframe through ID:
===========================================


public class SwitchToFrameDemo {
public static void main(String[] args) {

        WebDriver driver = new FirefoxDriver(); //navigates to the Browser
        driver.get("");
           // navigates to the page consisting an iframe

           driver.manage().window().maximize();
           driver.switchTo().frame("ramesh"); //switching the frame by ID

            System.out.println("********We are switch to the iframe*******");
            driver.findElement(By.xpath("html/body/a/img")).click();
            //Clicks the iframe
       
            System.out.println("");
      }
}