import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Google_search {
public static void main(String[] args) throws InterruptedException {
WebDriver dr= new FirefoxDriver();
dr.get("http://google.com");
dr.findElement(By.xpath("//input[@id='gbqfq']")).sendKeys("selenium");
Thread.sleep(10000L);
WebElement fr=dr.findElement(By.xpath("//div[@id='rcnt']"));
List<WebElement> friends_list=fr.findElements(By.tagName("a"));
for(WebElement link : friends_list)
System.out.println(link.getAttribute("href"));
}
}
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Google_search {
public static void main(String[] args) throws InterruptedException {
WebDriver dr= new FirefoxDriver();
dr.get("http://google.com");
dr.findElement(By.xpath("//input[@id='gbqfq']")).sendKeys("selenium");
Thread.sleep(10000L);
WebElement fr=dr.findElement(By.xpath("//div[@id='rcnt']"));
List<WebElement> friends_list=fr.findElements(By.tagName("a"));
for(WebElement link : friends_list)
System.out.println(link.getAttribute("href"));
}
}
No comments:
Post a Comment