Tuesday, January 4, 2011

Google Auto Complete Program

Here's simple program to accomplish google's autocomplete feature



package com.example.tests;

import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;

public class googleAutocomplete extends SeleneseTestCase {
    public void setUp() throws Exception {
        setUp("http://www.google.co.in/", "*chrome");
    }
    public void testGoogleAutocomplete() throws Exception {
        selenium.open("/");
        selenium.type("q", "sele");
        selenium.typeKeys("q", "nium");
        selenium.click("//div[@class='gac_id']/table/tbody/tr[3]/td");
        selenium.keyPress("btnG", "\\13");
    }
}

No comments:

Post a Comment