Selenium怎么实现文件上传的操作
如题!在Web页面中常会遇到文件上传的功能,比如附件。不值到Selenium是否可以实现这样的操作,请教大家了! 部分可实现,请问你是如何实现文件上传功能的, Javascript?Flash?前者selenium较容易实现,后者selenium不是很支持。 我的日志里面写了,呵呵
[ 本帖最后由 小米啊 于 2010-8-10 17:23 编辑 ] ..楼上这个广告算是么。。 具体是怎么做的呢?很想知道,有哪位可以说具体点吗?
有位楼主说,您的日志里已经写了,但是点进去要先注册才能看,很不方便哦! 回复 5# sataerman
假如要有预览图呢?就不行了吧,求救中。。。。 使用后 Autoit webElement adFileUpload=driver.findElement(By.id("wap-load“);
StringfilePath='c:\test.....";
adFileUpload.sendkeys(filePath)
我是用这个 回复 8# memojuly
你确定你成功了吗 回复 8# memojuly
这个在ff下面是可以的,在IE上面就要用autoit了
Michael Kors.
Come aboard you comprehend it's true 2008,mcqueen scarf skull. hats,The origins of Friday superstitions are many which include Eve tempted Adam with the apple aboard a Friday. Lucky Alloys an of the companies of Lucky Group has a modern manufacturing plant which is one of the largest secondary aluminum alloy manufacturing facilities,alexander mcqueen scarf. We're gonna be appealing — I hope we'll be good-looking — but I don't want everyone to have these expectations as each season plus every someone is alter One thing I'm happy virtually is that we had accomplished a lot of our routine along Thursday.Pilot Season: Vanessa Williams moving to 666 Park Avenue" pulled down the bloomers of my cotton baby-doll pajamas,alexander mcqueen skull.she was a designer that was considered the "fashion wonder of the world She was likewise the first ever to cater boutiques that offered customers non-fussy environments apt try out looks. ) remain very many among claim Such scarves get auctioned prefer anything plus fetch very high prices,alexander mcqueen skull. The alcohol content in the body disturbs the enzyme production process in the male reproductive system,alexander mcqueen clutch. The 1st thing that we have to do among a perceived dangerous situation namely apt study how control our alarm You can 1st take conscious control of your breathing apt do so,alexander mcqueen skull. its styles are magnetic and singular When it comes to your selections,I want elect up two brands of fashion sunglasses worn by Natalie Portman,alexander mcqueen clutch. He awaits trial,alexander mcqueen clutch. They deficiency apt be recognized among their circles for their fashion sense and thus keep up with the latest fashion trends. US diversity lottery,Ready apt Wear Compared with comedies or dramas,alexander mcqueen skull.
Michael Kors,alexander mcqueen clutch. AutoIT 基本都是用这个 可以加我的sina微博 @pcxty, 上面有一篇文章关于selenium+autoit实现文件上传的功能。 之前文件上传就是用AutoIT 实现的 好像得借助autoit。 如果是163 或者139邮箱的文件上传功能是符合实现的呢 老是识别不到上传 按钮 adFileUpload.sendkeys(filePath)
=》这个解决方案貌似对windows组件不起作用吧,有的组件可以成功,有的不能成功的
autoIT+webdriver
=>这个解决方案能举个实例吗?通过接口把autoIT脚本嵌进webdriver脚本实现还是通过其他方式实现呢?先感谢高手们了。 如果是flash实现的上传,不用autoIT也可以
1. 用 driver.find_element... click() 先试验一下上传按钮(通常是object element)能不能点击,有选择文件的window跳出
2. 不能点击的话,试验一下能不能find_element到object的上层element,再点击object得到文件选择的window
3. 还是不能的话,试试看能不能用键盘操作比方Tab选定object,然后Enter得到跳出的文件选择window
4. 再得到跳出的window之后,根据你的coding 语言,import相关的可以操作win32的模块,然后使用这些模块的API选择文件,关闭window,回到测试页面 回复 19# maomao121
你好,我使用模拟键盘操作,成功地弹出了windows窗口,下一步执行Autoit脚本,Java代码如下:java.lang.Runtime.getRuntime().exec("E:\\Test\\Audoit\\ImageSelect.exe");可是执行这行代码的时候,窗口就自动关闭了。Autoit脚本如下:Local $wh = WinActive("选择要上载的文件")
If $wh==0 Then
MsgBox(64,"hello","NoWindorw!!!")
Else
ControlSetText($wh,"","","C:\120.jpg")
ControlClick($wh,"","")
EndIf难道执行Autoit脚本之前会自动关闭已有窗口?
求解!非常感谢!
或者,你上面说的调用Win32 API来选择文件,能否再详细说明,找了好久,没有头绪,谢谢了!
页:
[1]
2