正在读取SVG中的标题标签? [英] Reading title tag in svg?

查看:49
本文介绍了正在读取SVG中的标题标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何阅读下面的文字?svg似乎是特例.

How do I read the text in below? svg seems to be a special case.

尝试了以下内容,但没有帮助

Tried the below, but of no help

//* [name()='svg']/标题

//*[name()='svg']/title

//* [name()='svg'和@ title ='Test']

//*[name()='svg' and @title='Test']

//* [name()='svg'并且包含(@ title,'Test')]

//*[name()='svg' and contains(@title,'Test')]

    <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 137 125" version="1.1">
        <title>Test</title>
        <desc>Created with Sketch.</desc>

推荐答案

要从< title> 标记中提取文本="post-tag" title =显示已标记'svg'的问题" rel =" tag> svg 定位器策略:

To extract the text from the <title> tag within the svg WebElement you can use either of the following Locator Strategies:

  • 使用 css_selector :

svg>title

  • 使用 xpath name():

    //*[name()='svg']/*[name()='title']
    

  • 使用 xpath local-name():

    //*[local-name()='svg']/*[local-name()='title']
    

  • 您可以在以下位置找到一些相关的讨论:

    You can find a couple of relevant discussions in:

    这篇关于正在读取SVG中的标题标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆