Test Upload File In Selenium

好久不见. 提交于 2020-01-05 09:24:08

问题


Currently i wish to run selenium for test excel upload. And my coding didn't working as expected. Just wondering how to resolve it. Every time i run the automated testing my code will be stop at this step:sendKeys("C:\Users\user\Desktop\JSPL Style Excel Upload.csv") without any error message show. Any suggestion?

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

来源:https://stackoverflow.com/questions/27917882/test-upload-file-in-selenium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!