Is it possible to use Selenium Webdriver to fetch a list of hyperlinks on a webpage with red/green color bullets based on user-provided IP data? These hyperlinks are generated dynamically. For example, when a user visits and enters a specific IP address, I need to extract hyperlinks with green and red colors separately. Can this task be automated using webdriver?
Here is the current script:
public class SelectCategory extends Config {
public static WebDriver driver;
@Test(enabled = true)
public void Blacklist1() throws IOException {
Properties p = new Properties(GetDataFromFile());
System.setProperty("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
driver = new FirefoxDriver();
driver.get(p.getProperty("BLURL"));
WebElement D1 = driver.findElement(By.xpath(".//*[@id='quickcheck']/input[1]"));
D1.clear();
D1.sendKeys(p.getProperty("IP1"));
WebElement D2 = driver.findElement(By.xpath(".//*[@id='quickcheck']/input[2]"));
D2.click();
}
public Properties GetDataFromFile() throws IOException {
File F = new File("*Path of properties file");
FileInputStream fis = new FileInputStream(F);
Properties prop = new Properties();
prop.load(fis);
return prop;
}
}