import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.*;
public class link1 {
public link1() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) throws InterruptedException {
String driverPath=System.getProperty("user.dir")+"/drivers/chromedriver.exe";
System.setProperty("webdriver.chrome.driver",driverPath);
WebDriver driver = new ChromeDriver();
driver.get("https://www.thesun.co.uk/");
List<WebElement> links=driver.findElements(By.tagName("a"));
for(WebElement link:links){
System.out.println(link.getAttribute("href"));
}
System.out.println("URL-----"+links.size());
}
}
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.*;
public class link1 {
public link1() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) throws InterruptedException {
String driverPath=System.getProperty("user.dir")+"/drivers/chromedriver.exe";
System.setProperty("webdriver.chrome.driver",driverPath);
WebDriver driver = new ChromeDriver();
driver.get("https://www.thesun.co.uk/");
List<WebElement> links=driver.findElements(By.tagName("a"));
for(WebElement link:links){
System.out.println(link.getAttribute("href"));
}
System.out.println("URL-----"+links.size());
}
}
No comments:
Post a Comment