Java Selenium中的测试上载文件
目前我希望运行selenium进行excel测试上传。我的编码也没有按预期工作。只是想知道如何解决它。每次运行自动测试时,我的代码都会在以下步骤停止:sendKeysC:\Users\user\Desktop\JSPL-Style Excel-Upload.csv,不会显示任何错误消息。有什么建议吗Java Selenium中的测试上载文件,java,selenium,junit,automated-tests,oracle-adf,Java,Selenium,Junit,Automated Tests,Oracle Adf,目前我希望运行selenium进行excel测试上传。我的编码也没有按预期工作。只是想知道如何解决它。每次运行自动测试时,我的代码都会在以下步骤停止:sendKeysC:\Users\user\Desktop\JSPL-Style Excel-Upload.csv,不会显示任何错误消息。有什么建议吗 @Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl =
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseUrl = "http://localhost:7101/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
public void testJava() throws Exception {
driver.get(baseUrl + "SCM_Telephone_Accounting_2-ViewController-context-root/faces/Main_Menu");
driver.findElement(By.id("np2:cni10")).click();
driver.findElement(By.id("r1:1:if1::content")).click();
driver.findElement(By.id("r1:1:if1::content")).clear();
driver.findElement(By.id("r1:1:if1::content")).sendKeys("C:\\Users\\user\\Desktop\\JSPL Style Excel Upload.csv");
driver.findElement(By.id("r1:1:cb1")).click();
}
你的意思是什么?我的编码没有按预期工作。您期望的是什么,以及此代码的结果有何不同?您是否考虑过类似的问题,例如:@JonnyHenly:我的自动运行测试用例将在此步骤停止:driver.findElementBy.idr1:1:if1::content.sendKeysC:\\Users\\user\\Desktop\\JSPL样式的Excel Upload.csv@我现在正在测试这个方法。我已经解决了它。@reto提供的链接确实有效。多谢各位^^