无法打开使用Selenium webdriver的Chrome浏览器。装载解压的扩展是被管理员禁用 [英] Unable to open chrome browser using Selenium Webdriver. Loading unpacked extensions are disabled by administrator

查看:3964
本文介绍了无法打开使用Selenium webdriver的Chrome浏览器。装载解压的扩展是被管理员禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我自动使用硒的webdriver,C#,Visual Studio和Chrome浏览器我的应用程序。



我收到以下弹出时硒试图打开Chrome浏览器。

 无法加载从分机:C:\Users\VARA〜1.PAK\AppData\Local\Temp \scoped_dir6712_14913\internal。解压扩展
装入被管理员禁用。

在我点击弹出窗口的确定按钮,浏览器被成功打开,但我的测试是由于失败。_3_EnterDetailsAndSelectAnAddress_John
。测试全名:Veolia.BrentGWP.UserStories.Features.BrentGWPFeature._3_EnterDetailsAndSelectAnAddress_John $以下错误

 测试名称b $ b。测试来源:在线2147483647 
。测试结果:失败
测试时间:0:00:47.8059413

结果消息:
试验方法Veolia.BrentGWP。 UserStories.Features.BrentGWPFeature._3_EnterDetailsAndSelectAnAddress_John抛出异常:
System.InvalidOperationException:未知的错误:无法从未知错误得到扩展的自动化
:页面无法找到:铬扩展://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(会话信息:铬= 41.0.2272.118)
(驾驶员信息:chromedriver = 2.9.248315,平台=的Windows NT 6.1 SP1的x86_64)
Assert.Fail失败。在OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(响应errorResponse)
在OpenQA.Selenium.Remote.RemoteWebDriver.Execute(字符串driverCommandToExecute
:请通过对场景
结果堆栈跟踪执行报告检查,Dictionary`2参数)
在OpenQA.Selenium.Remote.RemoteWebDriver.InternalExecute(字符串driverCommandToExecute,Dictionary`2参数)在OpenQA.Selenium.Remote.RemoteWindow.Maximize
()
。在Veolia.Libraries.Driver.BeforeScenario(c)中:\development\Veolia.Web.Brent\development\testing\Automation\Veolia.test.Framework\Libraries\Driver.cs:行105
。在lambda_method(封闭,IContextManager)
在TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding结合,IContextManager contextManager,对象[]参数,ITestTracer testTracer,时间跨度和放大器;持续时间)
在TechTalk。 SpecFlow.Bindings.BindingInvokerExtensions.InvokeHook(IBindingInvoker调用,IHookBinding hookBinding,IContextManager contextManager,ITestTracer testTracer)
在TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType bindingEvent)
在TechTalk.SpecFlow.Infrastructure.TestExecutionEngine .FireScenarioEvents(HookType bindingEvent)
在TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioStart(ScenarioInfo scenarioInfo)
在TechTalk.SpecFlow.TestRunner.OnScenarioStart(ScenarioInfo scenarioInfo)在Veolia.BrentGWP.UserStories
.Features.BrentGWPFeature.ScenarioSetup(scenarioInfo scenarioInfo)在C:\development\Veolia.Web.Brent\development\testing\Automation\Veolia.test.Framework\BrentGWP\UserStories\Features\ AddressSearch.feature.cs:在Veolia.BrentGWP.UserStories.Features.BrentGWPFeature._3_EnterDetailsAndSelectAnAddress(串名字,姓氏字符串,字符串邮编,电子邮件字符串,字符串phoneNumber的,字符串[] exampleTags)在C线0
:\ development\Veolia.Web.Brent\development\testing\Automation\Veolia.test.Framework\BrentGWP\UserStories\Features\AddressSearch.feature:在Veolia.BrentGWP线16
。 UserStories.Features.BrentGWPFeature._3_EnterDetailsAndSelectAnAddress_John(c)中:\development\Veolia.Web.Brent\development\testing\Automation\Veolia.test.Framework\BrentGWP\UserStories\Features\AddressSearch .feature.cs:0行

每当硒打开Chrome浏览器会自动扩展加载到镀铬工作吧。



但是,在我们的组织,我们使用的是谷歌邮件和我们的IT部门阻止添加扩展(第三方,并解压缩),以Chrome浏览器为安全起见。



如果我修改了注册表,以允许第三方扩展,测试成功执行。但是,我们的IT部门的每个系统(自动)每天更新的政策。



我试着用 AddExtension ChromeOptions 类,但他们没有工作,得到了同样的错误。


的AddArgument
方法

有人能帮我解决这个问题吗?


解决方案

我使用ChromeOptions类AddExtension和AddArgument方法试过了,但他们没有工作,得到了同样的错误。




我做了这样的事( JAVA ):

  ChromeOptions O =新ChromeOptions(); 
o.addArguments(禁用扩展);
o.addArguments( - 启动最大化);
webdriver的驱动程序=新ChromeDriver(O);



第二行是你所需要的东西。
第三行只是让铬窗口最大化。



弹出没有显示当前起来。 HTH。


I am automating my application using Selenium Webdriver, C#, Visual Studio and Chrome browser.

I am getting below popup when selenium tried to open the chrome browser.

Failed to load extension from:C:\Users\VARA~1.PAK\AppData\Local\Temp\scoped_dir6712_14913\internal.
Loading of unpacked extensions is disabled by the administrator.

Once I click on OK button of the popup, Chrome is opening successfully but my test is failing due to below error.

Test Name:  _3_EnterDetailsAndSelectAnAddress_John
Test FullName:  Veolia.BrentGWP.UserStories.Features.BrentGWPFeature._3_EnterDetailsAndSelectAnAddress_John
Test Source:     : line 2147483647
Test Outcome:   Failed
Test Duration:  0:00:47.8059413

Result Message: 
Test method Veolia.BrentGWP.UserStories.Features.BrentGWPFeature._3_EnterDetailsAndSelectAnAddress_John threw exception: 
System.InvalidOperationException: unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
  (Session info: chrome=41.0.2272.118)
  (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64)
Assert.Fail failed. Please check through the execution report against scenario
Result StackTrace:  
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.InternalExecute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWindow.Maximize()
   at Veolia.Libraries.Driver.BeforeScenario() in c:\development\Veolia.Web.Brent\development\testing\Automation\Veolia.test.Framework\Libraries\Driver.cs:line 105
   at lambda_method(Closure , IContextManager )
   at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
   at TechTalk.SpecFlow.Bindings.BindingInvokerExtensions.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, IContextManager contextManager, ITestTracer testTracer)
   at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType bindingEvent)
   at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireScenarioEvents(HookType bindingEvent)
   at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioStart(ScenarioInfo scenarioInfo)
   at TechTalk.SpecFlow.TestRunner.OnScenarioStart(ScenarioInfo scenarioInfo)
   at Veolia.BrentGWP.UserStories.Features.BrentGWPFeature.ScenarioSetup(ScenarioInfo scenarioInfo) in c:\development\Veolia.Web.Brent\development\testing\Automation\Veolia.test.Framework\BrentGWP\UserStories\Features\AddressSearch.feature.cs:line 0
   at Veolia.BrentGWP.UserStories.Features.BrentGWPFeature._3_EnterDetailsAndSelectAnAddress(String firstname, String lastname, String postcode, String email, String phoneNumber, String[] exampleTags) in c:\development\Veolia.Web.Brent\development\testing\Automation\Veolia.test.Framework\BrentGWP\UserStories\Features\AddressSearch.feature:line 16
   at Veolia.BrentGWP.UserStories.Features.BrentGWPFeature._3_EnterDetailsAndSelectAnAddress_John() in c:\development\Veolia.Web.Brent\development\testing\Automation\Veolia.test.Framework\BrentGWP\UserStories\Features\AddressSearch.feature.cs:line 0

Every time selenium open chrome it will load automation extension into chrome to work with it.

But in our organization we are using google mail and our IT department blocked adding extensions(third party and unpacked) to Chrome browser for security reasons.

If I modified the registry to allow third party extensions, test is executing successfully. But our IT department updates the policy every day on every system(automated).

I tried using AddExtension and AddArgument methods of ChromeOptions class, but none of them worked and got the same error.

Can someone help me to overcome this issue please?

解决方案

I tried using AddExtension and AddArgument methods of ChromeOptions class, but none of them worked and got the same error.

I did something like this (JAVA):

ChromeOptions o = new ChromeOptions();
o.addArguments("disable-extensions");
o.addArguments("--start-maximized");
WebDriver driver = new ChromeDriver(o);

The second line is all what you need. The third line is just making chrome window maximized.

The pop-up isn't showing up currently. HTH.

这篇关于无法打开使用Selenium webdriver的Chrome浏览器。装载解压的扩展是被管理员禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆