【发布时间】:2019-04-27 18:56:05
【问题描述】:
我以前使用过 selenium,但这个搜索框很难选择。
<div class="jobs-search-box__input jobs-search-box__input--keyword">
<button class="jobs-search-box__input-icon" type="button" data-ember-action="" data-ember-action-489="489">
<li-icon type="search-icon" role="img" aria-label="Search"><svg viewBox="0 0 24 24" width="24px" height="24px" x="0" y="0" preserveAspectRatio="xMinYMin meet" class="artdeco-icon" focusable="false"><path d="M21,19.67l-5.44-5.44a7,7,0,1,0-1.33,1.33L19.67,21ZM10,15.13A5.13,5.13,0,1,1,15.13,10,5.13,5.13,0,0,1,10,15.13Z" class="large-icon" style="fill: currentColor"></path></svg></li-icon>
</button>
<artdeco-typeahead-deprecated id="ember490" class="ember-view"><artdeco-typeahead-deprecated-input id="ember491" class="ember-view"> <input class="artdeco-typeahead-deprecated-input__ghost-text" placeholder="" aria-label="Search jobs" aria-hidden="true" disabled="" type="text">
<input role="combobox" autocomplete="off" spellcheck="false" aria-autocomplete="list" aria-invalid="false" aria-expanded="false" aria-label="Search jobs" id="jobs-search-box-keyword-id-ember488" placeholder="Search jobs" type="text">
</artdeco-typeahead-deprecated-input>
<!----><!----></artdeco-typeahead-deprecated></div>
我希望能够发送密钥。我已经成功地选择了文本框,并且我之前的搜索出现了,但是我得到一个错误“元素不可交互”,这表明我需要以某种方式找到输入元素。
【问题讨论】:
-
@QHarr OP 想要
send keys。有什么理由将css-selectors 替换为web-scraping? -
@QHarr 通过 xpath 和 css 与浏览器交互是完全不同的 webscraping 活动。您提到的完全是不同的意见先生:)
-
@DebanjanB 同意并更改
标签: python selenium xpath css-selectors webdriverwait