我想從下面的代碼中獲取文本。這裏我想複製.js_count
課文結果。硒的css選擇器
<div class="search-result-bar">
<div class="search-result-bar-country">
<a class="search-result-bar-country-title" href="javascript:void(0);" title="paris">paris </a>
<span class="search-result-bar-country-dot">
·
</span>
<span class="search-result-bar-country-count">
<span class="js_count">10146</span>
<span class="js_text"> rentals</span>
</span>
</div>
</div>
錯誤日誌:
*** Element info: {Using=css selector, value=span.js_count} at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at
java.lang.reflect.Constructor.newInstance(Unknown Source) at
org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:133)
嘗試xpath'「// span [@ class ='js_count']」' –
歡迎來到Stack Overflow!請閱讀[問]。 – JeffC