我正在开发一个包含具有自动保存功能的表单的项目。 我知道如何为字段发送数据,但我不知道如何检查这些字段是否自动保存。
这就是我所做的:
public class Ca1GeneralInformation {
private static WebElement element = null;
//Quick facts
public static WebElement ca1_companyName(WebDriver driver){
element = driver.findElement(By.id("ca1_GEN_coName"));
return element;
}
public static WebElement ca1_WebAdress(WebDriver driver){
element = driver.findElement(By.id("ca1_GEN_coURL"));
return element;
}
public static WebElement ca1_YearFounded(WebDriver driver){
element = driver.findElement(By.id("ca1_GEN_foundedDate"));
return element;
}
public static WebElement ca1_nameOfCeo(WebDriver driver){
element = driver.findElement(By.id("ca1_GEN_CEOname"));
return element;
}
public static WebElement ca1_titleOfCeo(WebDriver driver){
element = driver.findElement(By.id("ca1_GEN_CEOtitle"));
return element;
}
public static WebElement ca1_becomeCeo(WebDriver driver){
element = driver.findElement(By.id("ca1_GEN_CEOstart"));
return element;
}
public static WebElement ca1_CeoJoinYear(WebDriver driver){
element = driver.findElement(By.id("ca1_GEN_CEOjoin"));
return element;
}
public static WebElement ca1_CeoFirstPosition(WebDriver driver){
element = driver.findElement(By.id("ca1_GEN_CEOposition"));
return element;
}
}enter code here
//Send data for quick facts page
Ca1GeneralInformation.ca1_companyName(driver).clear();
Ca1GeneralInformation.ca1_companyName(driver).sendKeys("Test Company");
Ca1GeneralInformation.ca1_WebAdress(driver).clear();
Ca1GeneralInformation.ca1_WebAdress(driver).sendKeys("www.test.com");
Ca1GeneralInformation.ca1_YearFounded(driver).clear();
Ca1GeneralInformation.ca1_YearFounded(driver).sendKeys("2000");
Ca1GeneralInformation.ca1_nameOfCeo(driver).clear();
Ca1GeneralInformation.ca1_nameOfCeo(driver).sendKeys("mr.CEO");
Ca1GeneralInformation.ca1_titleOfCeo(driver).clear();
Ca1GeneralInformation.ca1_titleOfCeo(driver).sendKeys("CEO");
Ca1GeneralInformation.ca1_becomeCeo(driver).clear();
Ca1GeneralInformation.ca1_becomeCeo(driver).sendKeys("2002");
Ca1GeneralInformation.ca1_CeoJoinYear(driver).clear();
Ca1GeneralInformation.ca1_CeoJoinYear(driver).sendKeys("2001");
Ca1GeneralInformation.ca1_CeoFirstPosition(driver).clear();
Ca1GeneralInformation.ca1_CeoFirstPosition(driver).sendKeys("manager");
driver.close();
>
`
答案 0 :(得分:0)
在我们的应用程序中的类似情况 - 当您为输入字段输入一些文本并单击外部时,数据将保存在db上,并且还会显示在输入字段中。 (我们触发一个Ajax事件 - 模糊以更新我们的数据库)所以你可以尝试这些: