从弹出的选择框中选择硒的日期

时间:2019-03-13 10:44:25

标签: python selenium

我想更改turo rental car上的“旅行结束”日期,这是我的代码:

from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
options = webdriver.ChromeOptions()
options.add_argument("--user-agent='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36'")
#options.add_argument("headless")
driver=webdriver.Chrome(executable_path="/home/timmy/Python/chromedriver",chrome_options=options)

url="https://turo.com/rentals/cars/co/monument/chevrolet-corvette/524782?searchId=JBjDolXY"
driver.get(url)
#do something afterchanging date

我尝试过的是

search=driver.find_element_by_xpath('//*[@id="pageContainer-content"]/div[4]/div[3]/div[2]/div[1]/form/div[1]/div/div/div[2]/div/div/div/div/input')
#search.setAttribute("value":"2019-03-15")
#search.send_keys('2019-03-15')
#search.setText("2019-03-15")

但似乎没有什么改变,我也尝试过search.click(),它会弹出日期但无法编辑,有没有一种方法可以不用pyautogui来单击它。 我想要的是始终选择第二天(截至发帖日期为3月13日,即3月14日),如果14到15,依此类推...

感谢您的帮助。

0 个答案:

没有答案
相关问题