运行程序时出现错误,如果在chropath中检查我的xpath,则路径中没有错误,但是运行时出现错误“有效XPath表达式”。
<article xpath="1">
<div class="imagen">
<img src="https://image.tmdb.org/t/p/w154/bhgCVGl6BDXS8BfcUGzWU5EWnMb.jpg">
<div id="c28153" data-nonce="9f7f7584d7" data-id="28153" data-type="movie" class="cimport">
</div>
</div>
<div class="data">
<h3>It's Alive</h3>
<span>1974</span>
</div>
</article>
密码:
driver.find_element_by_xpath('//h3[translate(. ," - ; : ! , . * ? / \' " , " " )='its live']//preceding::img[1]//following::div[1]').click()
您需要使用:
driver.find_element_by_xpath('//h3[translate(. ," - ; : ! , . * ? / \' " , " " )=\'its live\']//preceding::img[1]//following::div[1]').click()
只是\
在内部之前添加'
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句