Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

ImageI am trying to get the "href" of a particular frame which you can find in the image , i tried as much as i can but i am not able to get the "href"

List<WebElement> list=d.findElements(By.xpath("html/body/table/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr/td/form/table/tbody/tr[52]/td"));

                   for(WebElement e : list){
                       String link = e.getAttribute("href");
                      System.out.println(link);

I tried the above code , i took the Xpath of that frame and tried to get the href of that frame . Link: "https://iaeme.com/ijciet/issues.asp?VType=8&IType=10&JType=IJCIET&PageNumber=1"

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
122 views
Welcome To Ask or Share your Answers For Others

1 Answer

As per the xpath you shared to get all the "href" attributes you can use the following code block :

List<WebElement> list = d.findElements(By.xpath("//form[@name='form1']/table/tbody/tr[last()]/td/a"));
    for(WebElement e : list)
        System.out.println(e.getAttribute("href"));

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...