@@ -0,0 +1,2319 @@
+/*%0A * (C) Copyright 2021 Boni Garcia (https://bonigarcia.github.io/)%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *   http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A *%0A */%0Apackage io.github.bonigarcia.wdm.test.extensions;%0A%0Aimport static io.github.bonigarcia.wdm.WebDriverManager.zipFolder;%0Aimport static org.assertj.core.api.Assertions.assertThat;%0A%0Aimport java.io.IOException;%0Aimport java.net.URISyntaxException;%0Aimport java.nio.file.Files;%0Aimport java.nio.file.Path;%0Aimport java.nio.file.Paths;%0Aimport java.time.Duration;%0A%0Aimport org.junit.jupiter.api.AfterEach;%0Aimport org.junit.jupiter.api.BeforeEach;%0Aimport org.junit.jupiter.api.Test;%0Aimport org.openqa.selenium.By;%0Aimport org.openqa.selenium.WebDriver;%0Aimport org.openqa.selenium.WebElement;%0Aimport org.openqa.selenium.firefox.FirefoxDriver;%0A%0Aimport io.github.bonigarcia.wdm.WebDriverManager;%0A%0Aclass InstallBrowserWatcherFirefoxTest %7B%0A%0A    WebDriver driver;%0A%0A    Path zippedExtension;%0A%0A    @BeforeEach%0A    void setup() throws URISyntaxException %7B%0A        Path extensionFolder = Paths%0A                .get(ClassLoader.getSystemResource(%22web-extension%22).toURI());%0A        zippedExtension = zipFolder(extensionFolder);%0A%0A        driver = WebDriverManager.firefoxdriver().create();%0A        ((FirefoxDriver) driver).installExtension(zippedExtension, true);%0A    %7D%0A%0A    @AfterEach%0A    void teardown() throws InterruptedException, IOException %7B%0A        // FIXME: pause for manual browser inspection%0A        Thread.sleep(Duration.ofSeconds(3).toMillis());%0A%0A        Files.delete(zippedExtension);%0A%0A        driver.quit();%0A    %7D%0A%0A    @Test%0A    void testExtensions() %7B%0A        driver.get(%22https://bonigarcia.dev/selenium-webdriver-java/%22);%0A%0A        WebElement h1 = driver.findElement(By.tagName(%22h1%22));%0A        assertThat(h1.getText())%0A                .isNotEqualTo(%22Hands-On Selenium WebDriver with Java%22);%0A    %7D%0A%0A%7D%0A

Include test installing browser extension in Firefox