有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Selenium中的java测试上载文件

目前我希望运行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) 个答案