get href value (WebDriver)

后端 未结 2 931
囚心锁ツ
囚心锁ツ 2021-02-05 10:16

How do I get a value from href?

like this eg:

Test
2条回答
  •  别跟我提以往
    2021-02-05 10:57

    You have pointed your element to 'div' instead of 'a'

    Try the below code

    driverCE.findElement(By.xpath("//div[@id='testId']/a")).getAttribute("href");
    

提交回复
热议问题