当我运行我的webdriver脚本时,我收到一个确认对话框,其中包含以下消息:
加载扩展时出错
无法从'C:\ Users\username\AppData\Local\Temp\scoped_dir6312_32763\internal'加载扩展程序.管理员禁用加载解压缩的扩展名.
你想重试吗?
是的
单击"是"可以运行测试.
我不知道为什么我提示这个对话框,
我已经尝试了下面提到的解决方法,但它们都没有工作:
在我的脚本中添加了以下代码:
ChromeOptions options = new ChromeOptions();
options.addArguments("no-sandbox");
options.addArguments("disable-extensions");
driver = new ChromeDriver(options);
Run Code Online (Sandbox Code Playgroud)以下是我的测试方法:
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");
}
Run Code Online (Sandbox Code Playgroud)
以下是调用浏览器的方法:
private void initChromeBrowser(){
System.setProperty("webdriver.chrome.driver", …Run Code Online (Sandbox Code Playgroud) java selenium google-chrome selenium-chromedriver chrome-automation-extension