在表单填写页面中,用户需要上传图像或pdf文档以供参考,但无法上传
WebDriverWait wait111 = new WebDriverWait(driver, 20);
WebElement invoice = wait111.until(ExpectedConditions.elementToBeClickable(By.className("mat-raised-button")));
invoice.sendKeys(("user.dir") +"/src/images/1.png");
Thread.sleep(5000);
还有
WebElement uploadElement1 = driver.findElement(By.xpath("//*[@id=\"main-wrapper\"]/app-registration/div/div/app-redeem/app-step2/mat-card/mat-card-content/form/div/div[12]/a"));
uploadElement1.sendKeys("/home/hashconnect/Downloads/2.png");
Thread.sleep(5000);
和
driver.findElement(By.className("mat-raised-button")).sendKeys(("user.dir") +"/src/images/1.png");
它应该上传文件,但显示错误消息,如
“线程“主”中的异常” org.openqa.selenium.ElementNotInteractableException:元素不 可互动的”