Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 当使用ChromeDriver和Selenium设置max属性时,无法使用send_键将日期作为文本发送到datepicker字段_Python_Selenium_Google Chrome_Selenium Chromedriver_Webdriverwait - Fatal编程技术网

Python 当使用ChromeDriver和Selenium设置max属性时,无法使用send_键将日期作为文本发送到datepicker字段

Python 当使用ChromeDriver和Selenium设置max属性时,无法使用send_键将日期作为文本发送到datepicker字段,python,selenium,google-chrome,selenium-chromedriver,webdriverwait,Python,Selenium,Google Chrome,Selenium Chromedriver,Webdriverwait,我正在尝试使用chromedriver下载一些文件 我已经切换到了chromedriver,因为在firefox中,我需要单击的链接打开了一个新窗口,即使在完成了所有必需的设置之后,下载对话框仍会出现,我无法绕过它 chromedriver可以很好地下载,但我似乎无法send_keys()到下面的元素,它可以在firefox上工作,但似乎无法让它在上面工作 要将字符序列发送到字段,理想情况下,您需要将元素的WebDriverWait设置为可点击(),并且您可以使用以下任一选项: 使用ID:

我正在尝试使用
chromedriver
下载一些文件

我已经切换到了
chromedriver
,因为在
firefox
中,我需要单击的链接打开了一个新窗口,即使在完成了所有必需的设置之后,下载对话框仍会出现,我无法绕过它

chromedriver
可以很好地下载,但我似乎无法
send_keys()
到下面的元素,它可以在firefox上工作,但似乎无法让它在上面工作


要将字符序列发送到
字段,理想情况下,您需要将
元素的WebDriverWait设置为可点击()
,并且您可以使用以下任一选项:

  • 使用
    ID

    el = WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.ID, "was-returns-reconciliation-report-start-date")))
    el.clear()
    el.send_keys("2020-02-12")
    
  • 使用
    CSS\u选择器

    el = WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, "input.was-form-control.was-input-date#was-returns-reconciliation-report-start-date")))
    el.clear()
    el.send_keys("2020-02-12")
    
  • 使用
    XPATH

    el = WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.XPATH, "//input[@class='was-form-control was-input-date' and @id='was-returns-reconciliation-report-start-date']")))
    el.clear()
    el.send_keys("2020-02-12")
    
  • 注意:您必须添加以下导入:

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    

是否有在
输入中单击而不是按键的选项?只是为了再来一杯approach@CeliusStingher我可以单击
datepicker
框,但是它没有帮助,因为值没有改变。你认为我可以检查链接还是它是私有的?@CeliusStingher该链接是私有的,它是一个企业登录后的链接。