如何访问SeleniumWebDriver下拉列表中的href选项
IDE的x路径链接是://a[contains(text(),'Alliance Entertainment Corp.(IV00000003)以获取WebElement的href use如何访问SeleniumWebDriver下拉列表中的href选项,selenium,webdriver,Selenium,Webdriver,IDE的x路径链接是://a[contains(text(),'Alliance Entertainment Corp.(IV00000003)以获取WebElement的href usegetAttribute()(java)方法。因此,在您的情况下,您可以通过以下方式实现: String href = driver.findElement(By.xpath("//a[contains(text(),'Alliance Entertainment Corp.(IV00000003)'")).g
getAttribute()
(java)方法。因此,在您的情况下,您可以通过以下方式实现:
String href = driver.findElement(By.xpath("//a[contains(text(),'Alliance Entertainment Corp.(IV00000003)'")).getAttribute("href");
这将返回此元素的url,即请将问题的任何部分(如HTML)添加到问题中,而不是添加到评论中。使用问题底部的编辑链接编辑问题。