Python Selenium:可以在两个xpath选择之间获取文本吗?

Python Selenium:可以在两个xpath选择之间获取文本吗?,python,regex,xpath,selenium,Python,Regex,Xpath,Selenium,我有: 标题 ... 我想在元素中选择的东西 ... 第一个和最后一个我可以通过xpath找到它们://center/h3和//a[@href=“index.html”] 我可以选择这两个xpath选项之间的区域吗?如果是,如何选择,或者应该在该页面的源代码中使用正则表达式 看一看,一种使用following在两个XPath之间进行选择的方法 这是工作代码: <center><h3>Title</h3></center> ... stuff he

我有:

标题
...
我想在元素中选择的东西
...
第一个和最后一个我可以通过xpath找到它们:
//center/h3
//a[@href=“index.html”]

我可以选择这两个xpath选项之间的区域吗?如果是,如何选择,或者应该在该页面的源代码中使用正则表达式

看一看,一种使用
following
在两个XPath之间进行选择的方法

这是工作代码:

<center><h3>Title</h3></center>
...
stuff here that I want selected in <p>...</p>elements
...
<a href="index.htm">Content</a>
看一看,一种使用
following
在两个XPath之间进行选择的方法

这是工作代码:

<center><h3>Title</h3></center>
...
stuff here that I want selected in <p>...</p>elements
...
<a href="index.htm">Content</a>
试试
//a[@href=“index.html”]/../p
试试
//a[@href=“index.html”]/../p