0

I have a selenium script which i want to run on some other user's machine. I have set 'firefox' as my default browser in the selenium script. Now the user's machine does not have 'firefox' installed on his machine. Is there any code available that can fetch which browser is installed on that user's machine and run the script in that browser?

I want to have 3 browsers in my script like IE, Firefox and Chrome. The script must run on any one browser which is installed on user's machine.

Any help will be appreciated. Thanks

4

1 回答 1

0

您要么必须有一些代码来查找每种浏览器(例如查找可执行文件,例如 chrome.exe 或 firefox.exe),要么您可能能够摆脱一些尝试获取 Selenium 的 try-catch 块启动浏览器,并将任何异常视为“浏览器不存在”。

我建议专门检查每种浏览器类型是更好的选择。

然后,您可以建立一个可用浏览器的列表,并有一些代码来选择其中一个(基于某种优先级/偏好)作为 Selenium 的目标

于 2013-01-15T07:06:09.600 回答