html tool

2015年5月6日星期三

selenium swf 处理 上传文件

问题:
上传文件使用的是flash按钮


参考:http://osdir.com/ml/selenium-users/2012-12/msg00657.html
You'd have to go with external tool like AutoIt or Sikuli.
[popexizhi]
看来selenium没有提供好的flash处理接口,上面提到的AutoIt我go了一下
参考:http://blog.csdn.net/kittyboy0001/article/details/25557147
是个“用来在Windows GUI(用户界面)中进行自动操作”,
ok,只能用这样的工具处理,我写了AHK的脚本,脚本如下:

#IfWinActive,打开 ;ahk_class #32770 ;切换到弹出的选择文件窗口
    WinActivate,打开 ;将窗口前置
    Send,c:\logo1.jpg ;输入文件地址
    Send,!+o ;打开文件操作
#IfWinActive

编译为exe进程在其他脚本中直接用了。

AHK相关资料:
http://blog.csdn.net/foxbryant/article/details/7605714
http://blog.csdn.net/foxbryant/article/details/7628392
要处理窗口的spy信息
>>>>>>>>>>( Window Title & Class )<<<<<<<<<<<
打开
ahk_class #32770

>>>>>>>>>>>>( Mouse Position )<<<<<<<<<<<<<
On Screen: 804, 643  (less often used)
In Active Window: 804, 599

>>>>>>>>>( Now Under Mouse Cursor )<<<<<<<<

Color: 0x000000  (Blue=00 Green=00 Red=00)

>>>>>>>>>>( Active Window Position )<<<<<<<<<<
left: 0     top: 44     width: 640     height: 512

>>>>>>>>>>>( Status Bar Text )<<<<<<<<<<

>>>>>>>>>>>( Visible Window Text )<<<<<<<<<<<
命名空间树控件
树视图
ShellView
文件名(&N):
文件类型(&T):
打开(&O)
取消
地址: 库\图片

>>>>>>>>>>>( Hidden Window Text )<<<<<<<<<<<
命名空间树控件
Shell Preview Extension Host
帮助(&H)

>>>>( TitleMatchMode=slow Visible Text )<<<<
*.jpg;*.jpeg;*.bmp;*.png;*.gif (*.jpg;*.jpeg;*.bmp;*.png;*.gif)

>>>>( TitleMatchMode=slow Hidden Text )<<<<



没有评论:

发表评论