小编Mic*_*ann的帖子

Sphinx autodoc show-inheritance:如何跳过无证的中间基础?

我有一个三层的类结构,如下所示:

class Super(object):
    """This class is documented."""

class Intermediate(Super):
    pass

class Sub(Intermediate):
    """This is also documented."""
Run Code Online (Sandbox Code Playgroud)

我的index.rst文件如下:

.. automodule:: mymodule
   :show-inheritance:
   :inherited-members:
Run Code Online (Sandbox Code Playgroud)

Sphinx为我生成了一个很好的API文档.它包括类SuperSub适当的注释.它不包括Intermediate,因为它没有评论,我没有提供undoc-members标志.这是因为我不想Intermediate出现在文档中.

我的问题是:因为我提供了show-inheritance标志,Sphinx显示每个类的基础; object对于SuperIntermediateSub.由于Intermediate没有文档,我不希望它出现在基类列表中.相反,我希望Sphinx在继承树中显示下一个记录的类,Super.换句话说:我希望Sphinx能够显示Super,而不是Intermediate作为基类Sub.

有人知道怎么做这个吗?

python python-2.7 python-sphinx

9
推荐指数
1
解决办法
3545
查看次数

XPath:通过*plain*text查找HTML元素

请注意:这个问题的更精确版本,以及适当的答案可以在这里找到.

我想使用Selenium Python绑定在网页上查找具有给定文本的元素.例如,假设我有以下HTML:

<html>
    <head>...</head>
    <body>
        <someElement>This can be found</someElement>
        <someOtherElement>This can <em>not</em> be found</someOtherElement>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

我需要通过文本搜索,并能够找到<someElement>使用以下XPath:

//*[contains(text(), 'This can be found')]
Run Code Online (Sandbox Code Playgroud)

我正在寻找一个类似的XPath,让我找到<someOtherElement>使用文本"This can not be found".以下不起作用:

//*[contains(text(), 'This can not be found')]
Run Code Online (Sandbox Code Playgroud)

我知道这是因为嵌套em元素"扰乱""无法找到这个"的文本流.是否可以通过XPath在某种程度上忽略上述类似或类似的嵌套?

python selenium xpath

9
推荐指数
1
解决办法
1万
查看次数

XPath:按纯文本查找HTML元素

请注意:这个问题是一个更完善的版本以前的问题.

我正在寻找一个XPath,它允许我在HTML文档中找到具有给定纯文本的元素.例如,假设我有以下HTML:

<html>
<head>...</head>
<body>
    <someElement>This can be found</someElement>
    <nested>
        <someOtherElement>This can <em>not</em> be found most nested</someOtherElement>
    </nested>
    <yetAnotherElement>This can <em>not</em> be found</yetAnotherElement>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我需要通过文本搜索,并能够找到<someElement>使用以下XPath:

//*[contains(text(), 'This can be found')]
Run Code Online (Sandbox Code Playgroud)

我正在寻找一个类似的XPath,让我找到<someOtherElement><yetAnotherElement>使用文本"This can not be found".以下不起作用:

//*[contains(text(), 'This can not be found')]
Run Code Online (Sandbox Code Playgroud)

我知道这是因为嵌套em元素"扰乱""无法找到这个"的文本流.是否可以通过XPath在某种程度上忽略上述类似或类似的嵌套?

html xpath

6
推荐指数
1
解决办法
2191
查看次数

Selenium WebDriver: To which extent can I rely on JavaScript?

I am developing a library that extends Selenium 2 with some custom commands. The library should be usable from Selenium's Java and Python bindings as well as in Selenium IDE. From my research, these three target bindings should cover at least 80% of all Selenium 2 scripts.

In order to implement my custom commands for Selenium IDE, I think I need to write a plugin for it in JavaScript.

My question is this: If I already have an …

javascript python java selenium webdriver

5
推荐指数
1
解决办法
502
查看次数