1

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"

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
sara
  • 39
  • 6
  • of which link you are trying to get href from the given page? – Ravi Potnuru Nov 15 '17 at 11:03
  • Please check the image buddy link : "https://iaeme.com/ijciet/issues.asp?VType=8&IType=10&JType=IJCIET&PageNumber=1" , In this link the page number frame at the bottom . – sara Nov 15 '17 at 11:06
  • use this //*[contains(@linktext,'issues.asp?VType=8&IType=10&JType=IJCIET&PageNumber="+n+"')] – Ravi Potnuru Nov 15 '17 at 11:13

1 Answers1

1

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"));
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • I want to know how did u generate the xpath which you used List list = d.findElements(By.xpath("//form[@name='form1']/table/tbody/tr[last()]/td/a")); – sara Nov 16 '17 at 09:26
  • 1
    i need help on similar problem , i want to know the xpath of the page number frame of this link , http://freevideolectures.com/Subject/Mathematics/VideoCourses/Page5 , Pls construct and give me . – sara Nov 16 '17 at 09:44