没有 H5 页面么?
通过修改,执行 JS 一样达到选择地区的目的。
已解决,你们说的方法我都试过,一个 for 循环解决了。
....
from selenium import webdriver
import time
driver = webdriver.Chrome()
driver.maximize_window()
driver.get("https://www.peninsula.com/en/hong-kong/luxury-hotel-room-suite-types/deluxe-room")
js = "window.scrollTo(0,1500)"
driver.execute_script(js)
time.sleep(2)
startdata_element = driver.find_element_by_xpath("//input[@aria-describedby='DateInput__screen-reader-message-startDate_bookingbar']")
startdata_element.click()
startdata_element.send_keys("01/05/2019")
time.sleep(2)
enddata_element = driver.find_element_by_xpath("//input[@aria-describedby='DateInput__screen-reader-message-endDate_bookingbar']")
enddata_element.click()
enddata_element.send_keys("02/05/2019")
time.sleep(2)
driver.find_element_by_xpath("/html/body/div[6]/div/div/div/div/div/div/button").click()