html - 有没有办法使用 Selenium/WebDriver 提取 html 评论?

标签 html selenium webdriver

我需要测试的 Web 应用程序由框架组成,末尾有一个 HTML 注释 ( <!-- some text --> ),当页面完成加载时它会出现。

最佳答案

您可以获取页面源并检查评论是否存在

 _driver.Navigate().GoToUrl("http://mysite.com");
  var source = _driver.PageSource;
  //check the source of the page to see if the commet is there.

关于html - 有没有办法使用 Selenium/WebDriver 提取 html 评论?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8416788/

相关文章:

java - 制作驱动程序 'universal'

selenium - NoSuchElementException,Selenium 无法定位元素

java - Mac selenium webdriver chrome 窗口总是以小窗口开头

html - 在 div 中使用鼠标滚轮水平滚动

html - 高度为 100% 的 Div,显示为 : Grid

javascript - 如何在html中添加侧边栏菜单?

javascript - 将 CSS 样式规则转换为 HTML 元素(反之亦然)

python - 如何正确点击网站上的按钮?

java - 无法在我的 MacBook 中使用 Firefox 浏览器打开网页

Selenium Webdriver - 在 If 语句中使用 isDisplayed() 不起作用