Selenium: How do I get the src of an image?

前端 未结 9 1027
抹茶落季
抹茶落季 2020-12-17 09:32

I\'m using Selenium (within PHPUnit) to test my web application. I would like to test whether a certain image which is present on the page really exists. More precisely, whe

9条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-17 10:01

    driver.findElement(By.cssSelector("img")).getAttribute("src")

提交回复
热议问题