简体   繁体   中英

Sendkeys selenium (python)

I am scraping a website using selenium with python. This website has a search engine that allows you to write. When I include the text, before hitting enter, I need to wait some time, otherwise it does the search. I wanted to know if there is a way to include a fluentwait instead of using time.sleep()

search_text = browser.find_element(By.CSS_SELECTOR, 'input#wuSearch')
search_text.click()
search_text.clear()
search_text.send_keys('text')
#time.sleep(2)
search_text.send_keys(Keys.ENTER)

There are different types of waits in selenium. You can find Selenium waits also, you can use Explicit waits or Implicit waits based on your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM