Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.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 3.x 如何保存输入字段上的信息-Python/Selenium_Python 3.x_Selenium Webdriver_Automation_Browser Automation - Fatal编程技术网

Python 3.x 如何保存输入字段上的信息-Python/Selenium

Python 3.x 如何保存输入字段上的信息-Python/Selenium,python-3.x,selenium-webdriver,automation,browser-automation,Python 3.x,Selenium Webdriver,Automation,Browser Automation,在我目前正在开发的这个项目中,我面临着一个不断发生的问题。 当我在输入中发送_key()一个值时,它有时打印在字段上,有时不打印 这是我的密码: def click(driver, locator): WebDriverWait(driver, 20).until(EC.presence_of_element_located(locator)).click() def sendKeys(driver, locator, value): WebDriverWait(driver

在我目前正在开发的这个项目中,我面临着一个不断发生的问题。 当我在输入中发送_key()一个值时,它有时打印在字段上,有时不打印

这是我的密码:

def click(driver, locator):
    WebDriverWait(driver, 20).until(EC.presence_of_element_located(locator)).click()


def sendKeys(driver, locator, value):
    WebDriverWait(driver, 20).until(EC.presence_of_element_located(locator)).clear()
    WebDriverWait(driver, 20).until(EC.presence_of_element_located(locator)).send_keys(value)

# Starting date
time.sleep(3)
click(driver, (By.XPATH, '/html/body/div[2]/div[1]/form/div[3]/div/div[2]/div[1]/div[1]/div[2]/div/div/input'))
driver.find_element_by_xpath('/html/body/div[2]/div[1]/form/div[3]/div/div[2]/div[1]/div[1]/div[2]/div/div/input').clear()
sendKeys(driver, (By.XPATH, '/html/body/div[2]/div[1]/form/div[3]/div/div[2]/div[1]/div[1]/div[2]/div/div/input'), googleSheet.dataPretApolice)

日期已写入,但有时当我单击下一个输入时,它会消失

是否有任何程序可以添加到代码中以保留数据

多谢各位