简体   繁体   English

线程“main” org.openqa.selenium.WebDriverException 中的异常:未知错误:无法获得自动化扩展

[英]Exception in thread “main” org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension

I am trying to login page using below script but while maximize window it shows me below error.我正在尝试使用以下脚本登录页面,但在最大化窗口时,它显示以下错误。

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html (Session info: chrome=57.0.2987.133) (Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 10.0.14393 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 10.11 seconds Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800' System info: host: 'PRASANNAMULAY', ip: '172.21.31.80', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9), u线程“main”org.openqa.selenium.WebDriverException 中的异常:未知错误:无法从未知错误中获取自动化扩展:找不到页面:chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html(会话信息:chrome=57.0. 2987.133) (驱动程序信息:chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 10.0.14393 x86_64) (WARNING10.14393 x86_64) (WARNING10.14393 x86_64) (WARNING10.13timeout 信息: WARNING10.13timeout .1',修订版:'5234b32',时间:'2017-03-10 09:04:52 -0800' 系统信息:主机:'PRASANNAMULAY',ip:'172.21.31.80',os.name:'Windows 10 ', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121' 驱动程序信息: org.openqa.selenium.chrome.ChromeDriver Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9), u serDataDir=C:\\Users\\PRASAN~1\\AppData\\Local\\Temp\\scoped_dir12528_8422}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=57.0.2987.133, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}] Session ID: 947fe656f81e3ced5cf5c932e81bc2f8 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.remote.ErrorHandler.createThrowable(ErrorHandler.java:216) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168) at org.openqa.selenium.remote.Remot serDataDir=C:\\Users\\PRASAN~1\\AppData\\Local\\Temp\\scoped_dir12528_8422},takesHeapSnapshot=true,pageLoadStrategy=normal,databaseEnabled=false,handlesAlerts=true,hasTouchScreen=false,version=57.0.2987.133,platform=XP, browserConnectionEnabled=false、nativeEvents=true、acceptSslCerts=true、locationContextEnabled=true、webStorageEnabled=true、browserName=chrome、takesScreenshot=true、javascriptEnabled=true、cssSelectorsEnabled=true、unexpectedAlertBehaviour=}] 会话 ID:947fe656f81e3ced5cf5c932e.reflectorcf5c932e. .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 .remote.ErrorHandler.createThrowable(ErrorHandler.java:216) 在 org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168) 在 org.openqa.selenium.remote.Remot eWebDriver.execute(RemoteWebDriver.java:638) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:661) at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.maximize(RemoteWebDriver.java:895) at pract_1_phase_3.Pract_1_phase_3.main(Pract_1_phase_3.java:48) eWebDriver.execute(RemoteWebDriver.java:638) 在 org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:661) 在 org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$WebDriverWindow. [895] 第895话

------------------------------------------------------------------------------------

My code is:-
package pract_1_phase_3;

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.FluentWait;
import org.openqa.selenium.support.ui.Wait;

import com.google.common.base.Function;

public class Pract_1_phase_3 {

    public static void main(String[] args)throws AWTException {

    //  System.setProperty("webdriver.gecko.driver","D:\\Gecko\\geckodriver.exe");


        ChromeOptions options = new ChromeOptions();

        Map<String, Object> prefs = new HashMap<String, Object>();
        prefs.put("credentials_enable_service", false);
        prefs.put("password_manager_enabled", false); 
        options.setExperimentalOption("prefs", prefs);

        ChromeDriver driver = new ChromeDriver(options);

        driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

        driver.get("http://demo.actitime.com/");

        driver.manage().window().maximize();

        driver.findElement(By.name("username")).sendKeys("admin");

        driver.findElement(By.name("pwd")).sendKeys("manager");

        driver.findElement(By.id("loginButton")).click();

Please tell me whats steps i need to do to resolve above issue

Thanks in advance

Upgrade to latest chromedriver.升级到最新的 chromedriver。

This was a bug and was resolved in chromedriver v2.28.这是一个错误,已在 chromedriver v2.28 中解决。 Refer: https://sites.google.com/a/chromium.org/chromedriver/downloads参考: https : //sites.google.com/a/chromium.org/chromedriver/downloads

I too face the same issue recently.我最近也面临同样的问题。 I took latest jar from https://chromedriver.storage.googleapis.com/index.html?path=2.29/ and added to my project.我从https://chromedriver.storage.googleapis.com/index.html?path=2.29/ 获取了最新的 jar 并添加到我的项目中。 The issue got resolved.问题得到了解决。

Try:尝试:

System.setProperty("webdriver.chrome.driver", "\\path\\to\\chromedriver");

and don't forget to add selenium.jar to your build path并且不要忘记将selenium.jar添加到您的构建路径中

Screen flickering can also lead to this error.屏幕闪烁也可能导致此错误。

solution reduce the window size to a screen becomes stable.解决方案将窗口大小减小到屏幕变得稳定。 I could resolve this issue by adding below code我可以通过添加以下代码来解决这个问题

 Dimension d = new Dimension(800, 600);
 driver.manage().window().setSize(d);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 线程“主” org.openqa.selenium.WebDriverException中的异常:未知错误:无法聚焦元素 - Exception in thread “main” org.openqa.selenium.WebDriverException: unknown error: cannot focus element 线程“主”org.openqa.selenium.WebDriverException 中的异常:未知错误:使用 Selenium 单击时无法确定加载状态错误 - Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot determine loading status error while clicking using Selenium 线程“主”org.openqa.selenium.WebDriverException 中的异常:未知错误:使用 Selenium Java 的意外命令响应 - Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: unexpected command response using Selenium Java 线程“ main” org.openqa.selenium.WebDriverException中的异常:未知错误:Chrome无法启动:正常退出 - Exception in thread “main” org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited normally 线程“主” org.openqa.selenium.WebDriverException中的异常:未定义$ - Exception in thread “main” org.openqa.selenium.WebDriverException: $ is not defined 线程“主” org.openqa.selenium.WebDriverException中的异常:无法访问Chrome - Exception in thread “main” org.openqa.selenium.WebDriverException: chrome not reachable 线程“主”org.openqa.selenium.WebDriverException 中的异常:权限被拒绝 - Exception in thread “main” org.openqa.selenium.WebDriverException: permission denied 如何修复线程“主”org.openqa.selenium.WebDriverException 中的异常? - How to fix Exception in thread “main” org.openqa.selenium.WebDriverException? 线程“ main”中的异常org.openqa.selenium.WebDriverException - Exception in thread “main” org.openqa.selenium.WebDriverException 线程“main”org.openqa.selenium.WebDriverException 中的异常:返回值无法转换为 WebElement:{stacktrace=Backtrace: - Exception in thread "main" org.openqa.selenium.WebDriverException: Returned value cannot be converted to WebElement: {stacktrace=Backtrace:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM