How make System.out.println show only links with /p/ ? I'm trying to write a program that would display all links by hashtag on Instagram. I was able to parse all links with the "a" tag. How can I now select links to a photo where /P/ is available?
String hashtag = null;
driver.get("https://www.instagram.com/explore/tags/"+hashtag);
String link_include= "/p/";
List<WebElement> all_links = driver.findElements(By.tagName("a"));
if (all_links.contains(link_include)){
//What do I need to write here for the variable to show links only with the /p/ ?can I use the append method? And How ?
}
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…