开发者

How to automate firefox with powershell?

I am currently doing the automation with power shell and I am stuck in the following problem , I have automated internet explorer with scripting in power shell,

But now i need to automate Firefox using this , i have searched and not able to track down , Is there any way or is it possible to automa开发者_开发知识库te FF with power shell ....suggestions are required.


Have a look at http://watin.org/ You can work with the watin.dll wich supports multiple browsers..

I started to use it because i needed a File Upload which comobject InternetExplorer.Application can't do...

Little snippet to get you started:

$watin     = [Reflection.Assembly]::LoadFrom( "c:\WatiN.Core.dll" ) 
$ie        = new-object WatiN.Core.IE("http://xyz.com") #Here you could load also Firefox with watin
$ie.TextField([watin.core.Find]::ByName("HF_Text1")).TypeText("Text1")
$ie.FileUpload([watin.core.Find]::ByName("HF_file")).Set("C:\text.txt") 
$ie.Button([watin.core.Find]::ByName("HF_Button")).Click()
$ie.WaitForComplete()
$ie.quit()

Note that you have to run Powershell in STA Mode when using WatiN (powershell.exe -sta)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜