The following code will show how we can add firefox addon with selenium
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | package com.webdriver_06; import java.io.File; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxProfile; public class MyAddon { public WebDriver driver; private String baseUrl; public static void main(String[] args){ MyAddon ma = new MyAddon(); ma.launch_browser(); } public void launch_browser() { try { String firebugFilePath = "F:\\xpi\\firebug.xpi" ; String firepathFilePath = "F:\\xpi\\firepath.xpi" ; FirefoxProfile profile = new FirefoxProfile(); profile.addExtension( new File(firebugFilePath)); profile.addExtension( new File(firepathFilePath)); driver = new FirefoxDriver(profile); driver.get(baseUrl); System.out.println( "Just open firefox - with two addin" ); wait( 500 ); driver.quit(); } catch (Exception ex) { ex.getMessage(); } } } |