【问题标题】:How to double click a particular part of text in web element using selenium web driver python?如何使用 selenium Web 驱动程序 python 双击 Web 元素中文本的特定部分?
【发布时间】:2019-04-30 02:33:47
【问题描述】:

我在双击并从文本中选择特定单词时遇到困难。

span class="NormalTextRun" style="background-color: inherit;">为测试创建的新机智

在这个 Html 文本(为测试而创建的新机智)中,我想双击并选择 只有测试这个词。

我使用过动作链,但它不起作用。

【问题讨论】:

  • 为什么不直接选择元素并获取innerHtml?
  • 你能解释一下吗,我没明白

标签: python-3.x selenium-webdriver ui-automation qa browser-automation


【解决方案1】:

您可以像这样探索使用 selenium 定位的元素:

el = driver.find_elements_by_class('NormalTextRun')
el.text  # will return `New wit created for testing`

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-24
    • 2019-05-04
    • 2015-09-19
    • 2020-12-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多