如何找到"href"?最后一个< tr>中的元素?

问题描述:

图片我正在尝试获取特定框架的"href"您可以在图像中找到,我已尽力而为,但我无法获得"href"

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);

我尝试了上面的代码,我使用了该框架的Xpath并尝试获取该框架的href.链接:" https://iaeme .com/ijciet/issues.asp?VType = 8& IType = 10& JType = IJCIET& PageNumber = 1 "

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"

根据您为获取所有"href"属性而共享的xpath,可以使用以下代码块:

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"));