<p>我正试图把“下一次月出”的时间拉到凌晨12:05(朝着<a href="https://www.timeanddate.com/moon/usa/tallahassee" rel="nofollow noreferrer">this</a>页的顶部)。它没有名称、ID,当我运行以下xpath时,它不起作用:</p>
<pre><code>nextMoonRise = driver.find_element_by_xpath('/html/body/div[1]/div[6]/main/article/section[1]/div/div[3]/p[7]/text()')
</code></pre>
<p>我收到的错误是:</p>
<pre><code> "selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: The result of the xpath expression "/html/body/div[1]/div[6]/main/article/section[1]/div/div[3]/p[7]/text()" is: [object Text]. It should be an element."
</code></pre>
<p>注意:Xpath工作正常,我以前也用过。正是这一特定的数据给了我问题</p>