selenium之点击input标签不起效

对upfile.html点击input标签不起效:




upload_file
rel="stylesheet" />
《Selenium2 Java 自动化测试实战》
102



upload_file






src="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.js">


原程序代码为:driver.findElement(By.name("file")).click();

执行报错:Exception in thread "main" org.openqa.selenium.InvalidArgumentException: 

改为

Actions action=new Actions(driver);

action.click(driver.findElement(By.name("file"))).perform();

执行成功,正常打开选择文件页面。


你可能感兴趣的:(selenium之点击input标签不起效)