When am running my webdriver script, am getting a confirmation dialog box with below message:
Error Loading Extension
Could not load extension from 'C:\Users\username\AppData\Local\Temp\scoped_dir6312_32763\internal'. Loading of unpacked extensions is disabled by the administrator.
Would you like to retry?
Yes No
Clicking "yes" lets the tests run.
I am not sure why am I getting this dialog box prompted,
I've tried the mentioned workarounds below but neither of them are working:
Added below code in my script:
ChromeOptions options = new ChromeOptions(); options.addArguments("no-sandbox"); options.addArguments("disable-extensions"); driver = new ChromeDriver(options);
Below is my Test method:
public void Login() throws IOException{ test = extent.startTest("Login"); signInPage = new SignInPage(driver); signInPage.enterMailId(); String screenShotPath = GetScreenShot.capture(driver, "enterMailId"); test.log(LogStatus.PASS, "Email id is entered successfully: " + test.addScreenCapture(screenShotPath)); signInPage.enterpwd(); //test.log(LogStatus.INFO, "Password is entered successfully"); screenShotPath = GetScreenShot.capture(driver, "enterpwd"); test.log(LogStatus.PASS, "Password is entered successfully: " + test.addScreenCapture(screenShotPath)); signInPage.clickOnLogin(); test.log(LogStatus.PASS, "User logged in successfully"); }
Below is the method which invoke the browser:
private void initChromeBrowser(){ System.setProperty("webdriver.chrome.driver", userdir +"\\chromedriver.exe"); ChromeOptions options = new ChromeOptions(); options.addArguments("test-type"); options.addArguments("no-sandbox"); //Fix for cannot get automation extension options.addArguments("disable-extensions"); options.addArguments("start-maximized"); options.addArguments("--js-flags=--expose-gc"); options.addArguments("disable-plugins"); options.addArguments("--enable-precise-memory-info"); options.addArguments("--disable-popup-blocking"); options.addArguments("--disable-default-apps"); options.addArguments("test-type=browser"); options.addArguments("disable-infobars"); driver = new ChromeDriver(options); launchApp(); }
Could there be anything else that I should incorporate in my script to prevent the dialog box.
In the task manager, locate the extension and tap End Process. This will disable the extension from the browser. Now, go to More Tools > Extensions and give the extension a fresh start by tapping on Reload. Even after the fixes above, if the extension doesn't load correctly, uninstall it and reinstall it.
The fix would be to talk to your IT team and find out why they have blacklisted chrome extensions, you will need them to delete them, restart your machine and run the test case again. It should be able to launch the chrome browser successfully this time.
Follow the steps to load the unpacked extension. Goto Chrome Settings using three dots on the top right corner. Then Select Extensions. Click on Load Unpacked and select your Unzip folder.
You can set the useAutomationExtension
capability to false.
ChromeOptions options = new ChromeOptions(); options.setExperimentalOption("useAutomationExtension", false); WebDriver driver = new ChromeDriver(options);
This capability will help to not load Chrome Automation extension. Due to which, "Failed to load extension" popup would not appear.
But please note you will not be able to perform any window resizing/positioning operations without the Chrome automation extension.
Hope this helps!
Source : https://bugs.chromium.org/p/chromedriver/issues/detail?id=1749
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With