51Testing软件测试论坛

标题: selenium怎么写上传附件的代码 [打印本页]

作者: bokewangyu    时间: 2014-8-6 14:07
标题: selenium怎么写上传附件的代码
这样脚本执行通过,但并没有上传成功
driver.findElement(By.id("SWFUpload_0")).sendKeys("E:\\105.jpg");



<object id="SWFUpload_0" class="swfupload" width="82" height="32" data="/Public/Uploadify/uploadify.swf?preventswfcaching=1407302081786" type="application/x-shockwave-flash" style="position: absolute; z-index: 1;">
<param value="transparent" name="wmode"/>
<param value="/Public/Uploadify/uploadify.swf?preventswfcaching=1407302081786" name="movie"/>
<param value="high" name="quality"/>
<param value="false" name="menu"/>
<param value="always" name="allowScriptAccess"/>
<param value="movieName=SWFUpload_0&uploadURL=http%3A%2F%2F192.168.1.122%2Findex.php%2FUcenter%2FHouse%2FUpload%2Fuid%2F138578%2Fformsession%2F2241dfd99158753576d0fccb4cb1c8ce.html&useQueryString=false&requeueOnError=false&httpSuccess=&assumeSuccessTimeout=30&params=&filePostName=Filedata&fileTypes=*.gif%3B%20*.jpg%3B%20*.png%3B%20*.bmp%3B%20*.jpeg&fileTypesDescription=Image%20Files&fileSizeLimit=0&fileUploadLimit=40&fileQueueLimit=999&debugEnabled=false&buttonImageURL=%2Findex.php%2FUcenter%2FHouse%2Fhouse%2Ftp%2FrentInfo%2Fid%2F&buttonWidth=82&buttonHeight=32&buttonText=&buttonTextTopPadding=0&buttonTextLeftPadding=0&buttonTextStyle=color%3A%20%23000000%3B%20font-size%3A%2016pt%3B&buttonAction=-110&buttonDisabled=false&buttonCursor=-2" name="flashvars"/>
</object>
作者: junhui18    时间: 2014-8-6 17:21
你把路径换成/E/105.jpg 试一下
作者: bokewangyu    时间: 2014-8-7 10:28
回复 2# junhui18


    已解决,selenium不支持flash,可以借助sikuli
作者: ceshi_    时间: 2015-11-9 17:48
bokewangyu 发表于 2014-8-7 10:28
回复 2# junhui18

老大 跪求sikuli怎么用啊  




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2