Selenium find_elements_ from a tag

后端 未结 2 866
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-29 06:01

I want to scrape some hotel information from Booking.com. The website provides some hotel informations, in this particular case, how many rooms are still available. The followin

2条回答
  •  无人及你
    2021-01-29 07:01

    Assuming that attribute is only associated with rooms left you can simply use attribute selector

    rooms_left = [item.get_attribute('data-x-left-count') for item in driver.find_elements_by_css_selector("[data-x-left-count]")]
    

提交回复
热议问题