目前,我可以使用selenium webdriver版本2.42.00和浏览器chrome上传文件,而我无法使用Internet Explorer版本11进行上传。
driver.findElement(By.id("fileUpload")).sendKeys(filePath);
其中id = fileUpload
用于带type=file
的输入元素,此字段为隐藏字段。
有任何想法:
org.openqa.selenium.ElementNotVisibleException:未显示元素(警告:服务器未提供任何堆栈跟踪信息) 命令持续时间或超时:30毫秒 构建信息:版本:'2.44.0',修订版:'76d78cf323ce037c5f92db6c1bba601c2ac43ad8',时间:'2014-10-23 13:11:40' 系统信息:主机:'XXXXXXX',ip:'192.168.12.24',os.name:'Windows 7',os.arch:'x86',os.version:'6.1',java.version:'1.8.0_40 “ 驱动程序信息:org.openqa.selenium.ie.InternetExplorerDriver Capabilities [{browserAttachTimeout = 0,enablePersistentHover = false,ie.forceCreateProcessApi = false,ie.usePerProcessProxy = false,ignoreZoomSetting = false,handlesAlerts = true,version = 11,platform = WINDOWS,nativeEvents = true,ie.ensureCleanSession = false,elementScrollBehavior = 0,ie.browserCommandLineSwitches =,requireWindowFocus = true,browserName = internet explorer,initialBrowserUrl = http://localhost:7704/ takesScreenshot = true,javascriptEnabled = true,ignoreProtectedModeSettings = false,enableElementCacheCleanup = true,cssSelectorsEnabled = true,unexpectedAlertBehaviour = dismiss}] 会议ID:cfa81fae-4ea2-43b9-9e3a-69135462fe82 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)〜[na:1.8.0_40] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)〜[na:1.8.0_40] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)〜[na:1.8.0_40]