如何找到“href"最后一个 <tr>元素? [英] How to find the "href" of the last <tr> element?
本文介绍了如何找到“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"
推荐答案
根据您共享的 xpath
获取所有href"属性,您可以使用以下代码块:
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"));
这篇关于如何找到“href"最后一个 <tr>元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文