【问题标题】:From which place Selenium Webdriver gets title - using driver.titleSelenium Webdriver 从哪个地方获得标题 - 使用 driver.title
【发布时间】:2018-12-14 15:24:28
【问题描述】:

Selenium Webdriver 通常从哪个地方获得标题 - 使用 driver.title

  • 来自页面来源
  • 或来自 DOM 结构

【问题讨论】:

    标签: selenium selenium-webdriver webdriver page-title webdriver-w3c-spec


    【解决方案1】:

    标题

    title 返回当前页面的标题。

    • 用法:

      title = driver.title
      
    • 定义:

      def title(self):
      """Returns the title of the current page.
      
      :Usage:
          title = driver.title
      """
      resp = self.execute(Command.GET_TITLE)
      
    • 详细信息:当您调用 driver.title 时,HTTP GET request 会通过 /session/{session id}/title URI 模板

    注意:该命令返回当前顶级浏览上下文的文档标题,相当于调用document.title

    • 远程结束步骤是:
      • 如果当前顶级浏览上下文不再打开,则返回错误,错误代码为 no such window。
      • 处理任何用户提示并在错误时返回其值。
      • 令title为调用算法的结果,获取当前顶级浏览上下文的活动文档的title属性。
      • 用数据标题返回成功。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-17
      • 2023-03-30
      • 2015-06-14
      • 2012-01-20
      • 1970-01-01
      • 2019-07-09
      • 1970-01-01
      • 2017-02-14
      相关资源
      最近更新 更多