如何在flash-selenium.jar中使用FlashSelenium类设置变量



我想要实现的是:

public class UploadVideo {
FlashSelenium flashapp = new FlashSelenium(null, null);
...
...
public void upload (){
flashapp.SetVariable(driver.findElement(By.id("flashInputButton")), "C:/testvid.mp4");
  }
}

但这在.SetVariable上给出了错误,它是

FlashSelenium类型中的方法SetVariable(String,String)是不适用于参数(WebElement,String)

我之所以这么做,是因为普通的.sendKeys()方法不适用于此元素。所以我想借助flash(flex)

请让我知道我做错了什么,我该如何纠正
请在这里查找图片和html代码。我在这里附上了绿色的图片
https://stackoverflow.com/questions/17588703/error-in-browsing-file-via-webdriver
我已经尝试使用使不可见元素可见

WebElement upload = driver.findElement(By.id("html5InputFile"));
((JavascriptExecutor) driver)
                .executeScript(
                        "arguments[0].style.visibility = 'visible';",
                        upload);
upload.sendKeys("C:\IE10test.mp4");

在运行时,这会给出"元素不可见或可能无法与之交互"执行

SetVariable命令更改flash在网站上存储的变量。它不需要网络元素。如果你能找到存储flash上传位置的变量,那么你可以做这样的事情:

flashapp.SetVariable("variableName", "C:/testvid.mp4");

完成后,您可以点击上传按钮。

最新更新