我正在使用selenium webdriver来完成一个表单,但是想要在键入时模拟人类行为而不是自动填充我的值.
例如:
driver.find_element_by_id("Address").send_keys("Anthony Street 35th")
Run Code Online (Sandbox Code Playgroud)
我想在输入安东尼街时模拟人类行为,每次击键之间随机时间暂停.
可以这样做吗?
这是我试图抓取的HTML:
<span class="meta-attributes__attr-tags">
<a href="/tags/cinematic" title="cinematic">cinematic</a>,
<a href="/tags/dissolve" title="dissolve">dissolve</a>,
<a href="/tags/epic" title="epic">epic</a>,
<a href="/tags/fly" title="fly">fly</a>,
</span>
Run Code Online (Sandbox Code Playgroud)
我想得到每个href的锚文本:电影,溶解,史诗等.
这是我的代码:
url = urllib2.urlopen("http: example.com")
content = url.read()
soup = BeautifulSoup(content)
links = soup.find_all("span", {"class": "meta-attributes__attr-tags"})
for link in links:
print link.find_all('a')['href']
Run Code Online (Sandbox Code Playgroud)
如果我用"link.find_all"来做,我得到错误:TypeError:List索引必须是整数,而不是str.
但是,如果我打印link.find('a')['href']我只得到第一个.
我怎样才能得到所有这些?