import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class web_getalllinks_google
{
public static void main(String[] args) throws Exception
{
String str;
FirefoxDriver fd=new FirefoxDriver();
fd.get("http://www.google.com");
fd.findElement(By.name("q")).sendKeys("testing");
fd.findElement(By.name("btnG")).click();
Thread.sleep(3000);
List lst=fd.findElements(By.tagName("a"));
for(WebElement e :lst)
{
str=e.getText().toLowerCase();
if(str.contains("testing"))
{
System.out.println(str);
}
}
}
}
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class web_getalllinks_google
{
public static void main(String[] args) throws Exception
{
String str;
FirefoxDriver fd=new FirefoxDriver();
fd.get("http://www.google.com");
fd.findElement(By.name("q")).sendKeys("testing");
fd.findElement(By.name("btnG")).click();
Thread.sleep(3000);
List
for(WebElement e :lst)
{
str=e.getText().toLowerCase();
if(str.contains("testing"))
{
System.out.println(str);
}
}
}
}
Comments
Post a Comment