wistbean / wistbean/learn_python3_spider
**获取到搜索的input框后需要先.click()然后再.send_keys()**
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 22.1k
- Forks
- 3.9k
- PR merge metrics
- No merged PRs in 30d
Description
获取到搜索的input框后需要先.click()然后再.send_keys()
`def search():
try:
print('start visit bilibili...')
browser.get('https://www.bilibili.com/')
search_input = WAIT.until(EC.element_to_be_clickable((By.CSS_SELECTOR, "#nav-searchform > div.nav-search-content > input")))
search_input.click()
search_input.send_keys('蔡徐坤篮球')
search_submit = WAIT.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="nav-searchform"]/div[2]')))
search_submit.click()
print('jump to new window')
all_h = browser.window_handles
browser.switch_to.window(all_h[1])
except TimeoutException:
return search()`
Originally posted by @ls-6414 in https://github.com/wistbean/learn_python3_spider/issues/6#issuecomment-1205865402
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the search() entry point and reproduce the Bilibili search flow using the selectors shown in the issue. Verify that the search input is clicked before text is sent and that the search result window is reached; done means the flow completes without the reported input interaction failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100