Python 3.x 如何保存输入字段上的信息-Python/Selenium
在我目前正在开发的这个项目中,我面临着一个不断发生的问题。 当我在输入中发送_key()一个值时,它有时打印在字段上,有时不打印 这是我的密码: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
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)
日期已写入,但有时当我单击下一个输入时,它会消失
是否有任何程序可以添加到代码中以保留数据
多谢各位