instantiate chrome object in powershell

∥☆過路亽.° 提交于 2019-12-03 06:51:34

问题


I have a powershell script which works just fine in IE however I need to also have it work in Chrome. $ie = new-object -com "InternetExplorer.Application" Works fine for IE. How do I instantiate the Chrome browser?


回答1:


You can start a process by name and even pass it a parameter, like this:

Start-Process "chrome.exe" "www.google.com"



回答2:


if you are fine with a 3rd party dll you could use Selenium which has also a Chromdriver, that gives you the same kind of control over Chrome as through InternetExplorer.Application COM

Selenium webpage

There is also a PowerShell wrapper for Selenium available on CodePlex

http://sepsx.codeplex.com/




回答3:


I Have tested this link and it works.

Different ways to open application/programs in powershell



来源:https://stackoverflow.com/questions/19364189/instantiate-chrome-object-in-powershell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!