Check spelling error for links in a page

The below code will retrieve all the links in the specific page and adds them to microsoft word and then check for the spelling errors

Dim Desc
Set mw=CreateObject(“Word.Application”)     '‘Creating the Word object
Set Desc=Description.Create  '`Creating the properties collection object
Desc("micclass").value="Link" 'Entering Properties information into object
Set TotLinks=Browser("Browsername").Page("Pagename").ChildObjects(Desc)          'retrieving the link names through child objects on page
For (i=0 to TotLinks.count-1)
    mw.WordBasic.filenew                  'To open new word basic file
    LinkName=TotLinks(i).GetROProperty(“name”)                         'Taking the name property of every individual object
    mw.WordBasic.insert LinkName & " "
    if mw.ActiveDocument.Spellingerrors.count>0 then
        Reporter.Reportevent micFail, "Spelling mistake","Link name:" & LinkName               
    End if
    mw.ActiveDocument.Close(False)
next
mw.quit

Handling alert in Selenium RC


package com.softwaretesting_guru.help;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.server.SeleniumServer;

import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.SeleneseTestCase;


public class AlertTest extends SeleneseTestCase {
      SeleniumServer ss;

      @Before
      public void setUp() throws Exception {
            // Start Selenium Server
            SeleniumServer ss = new SeleniumServer();
            ss.start();
            // Start Selenium
            selenium = new DefaultSelenium("localhost", 4444, "firefox",
                        "https://irctc.co.in");
            selenium.start();

      }

      @After
      public void tearDown() throws Exception {

      }

      @Test
      public void test() throws InterruptedException {
            // open the browser
            selenium.open("/");
            // maxmize the browser
            selenium.windowMaximize();
            // click on login button
            selenium.click("id=button");
            // expected result user should get alert using selenium verify alert and
            // handel the alert
            // verifying the alert
            if (selenium.isAlertPresent()) { // handel the alert
                  selenium.getAlert();
                  System.out.println("Alert Present");

            } else {
                  System.out.println("There is no alert present test case fail");
            }
            // enter username
            selenium.type("name=userName", "selenium");
            // enter password
            selenium.type("name=password", "selenium");

            Thread.sleep(5000);
            // getting the alert text use below code
            // Store the alert text
            String str = selenium.getAlert();
            // print alert text
            System.out.println(str);
            // compare the str text and alert text
            String alert = "Enter Value for  UserName";
            if (alert.equals(str)) {
                  // handel alert
                  System.out.println("Alert Present");

            } else {
                  System.out.println("There is no alert");
            }

            Thread.sleep(5000);
      }

}
 
By: Manoj Kumar

                                

Agile methodology

What Is Agile?

Agile methodology is driven by face to face communication than written documents. It is an alternative to waterfall model but in incremental manner. The daily tasks are divided into small increments called sprints with minimum planning that don’t include long term planning. The collection of sprints is called product backlog. These are iteration which last from one to four weeks. Each iteration would include planning, requirement analysis, design, coding  and testing. So, at the end of each iteration, a working product will be in a position to be demonstrated to the stake holders. The face to face meetings will be held in the first hour of the day before the team starts their work. These meetings are termed as Scrum meetings and will not last more than 15 minutes. These are also termed as stand up meetings.

Burn down charts are drawn and will display the progress.

Scrum team has only three roles: Product Owner, Team, and Scrum Master.

Product Owner: The Product Owner represents the stakeholders and are accountable for team deliverables.

Development Team: The development team is the core team that develops the planned sprints from the product backlog.

Scrum Master: Scrum is facilitated by a ScrumMaster. The ScrumMaster ensures that the Scrum process is used as intended. The ScrumMaster enforces all rules that would be followed by the team.

Advantages:

1.    Agile Methodology helps in saving Time and Money.
2.    Great transparency as whole team will be involved on regular basis
3.    Less documentation that will help in concentrating on the product than the documentation
4.    Issues can be quickly tracked and closed due to daily meetings
5.    Change requests can be implemented as the feedback will be collected for every sprint

Handling Window based pop ups using web driver





    public void handleWindowsPopup() throws InterruptedException, AWTException {
        driver=new FirefoxDriver();
        driver.get("http://www.google.co.in");
        driver.findElement(By.id("gbqfq")).sendKeys("java download");
        Thread.sleep(3000);
        driver.findElement(By.id("gbqfb")).click();
        Thread.sleep(5000);
        driver.findElement(By.xpath("//h3[@class='r']/a")).click();
        Thread.sleep(5000);
        driver.findElement(By.xpath("//a[@class='jvdla0']")).click();
        Thread.sleep(5000);
        driver.findElement(By.xpath("//a[@class='jvdla0']")).click();
        Thread.sleep(5000);
        Robot robot=new Robot();
        robot.keyPress(KeyEvent.VK_TAB);
        Thread.sleep(2000);
        robot.keyPress(KeyEvent.VK_ENTER);
        Thread.sleep(5000);
        //driver.quit();
    }
     

Reading values from DB using Web driver



public class DBdataintoArraylist {
      public void studentData() throws SQLException, ClassNotFoundException {
            List<GetDBvaluesofAllDatatypes> list = new ArrayList<GetDBvaluesofAllDatatypes>();
            String driver = "com.mysql.jdbc.Driver";
            String dburl = "jdbc:mysql://localhost/test";
            String usrname = "root";
            String pswd = "root";
            String query = "SELECT * FROM Student WHERE section='A'";
            Class.forName(driver);
            Connection conn = DriverManager.getConnection(dburl, usrname, pswd);
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery(query);
            while (rs.next()) {

                  GetDBvaluesofAllDatatypes gdb = new GetDBvaluesofAllDatatypes(
                              rs.getString("First_Name"), rs.getString("Last_Name"), rs.getInt("marks"),
                              rs.getString("Grade"), rs.getString("Section"), rs.getString("Birth_Date"));
                  list.add(gdb);
            }

            for (GetDBvaluesofAllDatatypes gdb : list) {
                  System.out.println(gdb.getFname());
                  System.out.println(gdb.getLname());
                  System.out.println(gdb.getGrade());
                  System.out.println(gdb.getMarks());
                  System.out.println(gdb.getSection());
                  System.out.println(gdb.getDate());
            }

      }