在Selenium中测试上载文件

时间:2015-01-13 08:37:18

标签: java selenium junit automated-tests oracle-adf

目前我希望运行selenium来测试excel上传。我的编码没有按预期工作。只是想知道如何解决它。每次我运行自动化测试时,我的代码将在此步骤停止:sendKeys(“C:\ Users \ user \ Desktop \ JSPL Style Excel Upload.csv”),不显示任何错误消息。有什么建议吗?

  @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();
  }

0 个答案:

没有答案