当作为本地系统用户运行时,使用chrome的selenium问题

时间:2013-06-19 16:53:40

标签: windows selenium windows-7 selenium-rc local-system-account

3我正在使用selenium-server-standalone-2.33.0.jar来启动selenium测试套件。我有一个测试套件,在firefox和Internet Explorer中运行得非常好。当我尝试在Google Chrome中运行它时,它对当前用户运行正常。当我尝试从本地系统用户运行测试(打开以本地系统用户身份运行的命令窗口)时,测试失败,给我一个Windows注册表异常。这是我试图运行的命令:

java -jar selenium-server-standalone-2.33.0.jar -port 5885 -htmlsuite "*googlechrome" "http://www.google.com" "TestSuite.html" "results.html"

这是我得到的例外:

HTML suite exception seen:
java.lang.RuntimeException: org.openqa.selenium.os.WindowsRegistryException: Problem while managing
the registry, OS Version '6.1', regVersion1 = false
Build info: version: '2.33.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_38'
Driver info: driver.version: unknown
    at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.createBrowserLauncher(
BrowserLauncherFactory.java:175)
    at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.getBrowserLauncher(Bro
wserLauncherFactory.java:109)
    at org.openqa.selenium.server.htmlrunner.HTMLLauncher.getBrowserLauncher(HTMLLauncher.java:7
9)
    at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:139)
    at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:198)
    at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:630)
    at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:305)
    at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:245)
    at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:54)
Caused by: org.openqa.selenium.os.WindowsRegistryException: Problem while managing the registry, OS
Version '6.1', regVersion1 = false
Build info: version: '2.33.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_38'
Driver info: driver.version: unknown
    at org.openqa.selenium.os.WindowsUtils.executeCommand(WindowsUtils.java:558)
    at org.openqa.selenium.os.WindowsUtils.runRegQuery(WindowsUtils.java:627)
    at org.openqa.selenium.os.WindowsUtils.readStringRegistryValue(WindowsUtils.java:447)
    at org.openqa.selenium.os.WindowsUtils.getLocalAppDataPath(WindowsUtils.java:274)
    at org.openqa.selenium.browserlaunchers.locators.GoogleChromeLocator.usualWindowsLauncherLoc
ations(GoogleChromeLocator.java:64)
    at org.openqa.selenium.browserlaunchers.locators.GoogleChromeLocator.usualLauncherLocations(
GoogleChromeLocator.java:50)
    at org.openqa.selenium.browserlaunchers.locators.SingleBrowserLocator.browserDefaultPath(Sin
gleBrowserLocator.java:93)
    at org.openqa.selenium.browserlaunchers.locators.SingleBrowserLocator.findAtADefaultLocation
(SingleBrowserLocator.java:81)
    at org.openqa.selenium.browserlaunchers.locators.SingleBrowserLocator.findBrowserLocation(Si
ngleBrowserLocator.java:50)
    at org.openqa.selenium.browserlaunchers.locators.SingleBrowserLocator.findBrowserLocationOrF
ail(SingleBrowserLocator.java:38)
    at org.openqa.selenium.server.browserlaunchers.BrowserInstallationCache.locateBrowserInstall
ation(BrowserInstallationCache.java:46)
    at org.openqa.selenium.server.browserlaunchers.GoogleChromeLauncher.<init>(GoogleChromeLaunc
her.java:67)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.createBrowserLauncher(
BrowserLauncherFactory.java:164)
    ... 8 more
Caused by: java.lang.RuntimeException: exec return code 1:

ERROR: The system was unable to find the specified registry key or value.

    at org.openqa.selenium.os.WindowsRegistryException.<init>(WindowsRegistryException.java:35)
    ... 25 more

最终我想允许selenium作为服务运行,因此我需要Chrome才能在本地系统帐户下运行。根据我的理解,selenium独立jar文件应该已经包含一个谷歌浏览器驱动程序,所以我没有理由需要下载它。

此外,在运行测试套件时遇到错误之前,我告诉我需要将Google Chrome添加到路径变量中。我这样做,而是我得到上面的错误,所以好像selenium可以找到chrome.exe,它只是有问题要么获得一些不存在的注册表项或找不到它后启动chrome。我为所有用户安装了chrome,因此Google Chrome安装在Program Files(x86)中。同样,chrome从我当前的帐户(我用来安装chrome的帐户)运行管理员权限时测试PASS。任何关于这个问题的帮助都会很棒!

0 个答案:

没有答案
相关问题