首页 > 解决方案 > 如何在 python selenium 中执行“https://raw.githubusercontent.com/GoogleChrome/accessibility-developer-tools/stable/dist/js/axs_testing.js”网址?

问题描述

我正在尝试使用 python selenium 编写以下代码,但由于我是 python 和 selenium 的新手,所以无法做到这一点。有人可以帮忙吗?

val driver = org.openqa.selenium.firefox.FirefoxDriver //use driver of your choice
val jse = driver.asInstanceOf[JavascriptExecutor]
jse.executeScript(scala.io.Source.fromURL("https://raw.githubusercontent.com/GoogleChrome/" +
   "accessibility-developer-tools/stable/dist/js/axs_testing.js").mkString)
val report = jse.executeScript("var results = axs.Audit.run();return axs.Audit.createReport(results);")
println(report)

标签: pythonselenium-webdriver

解决方案


推荐阅读