UI Automation - Chrome Driver Cannot Load Flash Plugin
程序员文章站
2022-07-13 21:28:36
...
Since Chrome driver won't setup flash plugin by default, then we can add it in coding when initial drvier.
Here is the simple demo:
If necessary, here is the way to set all user configurations of Chrome browser for Chrome webdriver, such as tags and plugins.
Here is the simple demo:
System.setProperty("webdriver.chrome.driver", "C:/chromedriver.exe"); ChromeOptions options = new ChromeOptions(); //set "--ppapi-flash-path" as pepflashplayer.dll loaction. can check in Chrome browser with "chrome://flash/" options.addArguments("--ppapi-flash-path=" + installPath); // add follwing param if always popup outdate message. options.addArguments("--allow-outdated-plugins=true"); WebDriver driver = new ChromeDriver(options); // open the home page of Baidu driver.get("http://www.baidu.com/");
If necessary, here is the way to set all user configurations of Chrome browser for Chrome webdriver, such as tags and plugins.
options.addArguments("user-data-dir=" + System.getProperty("user.home").replace("\\", "/") + "/AppData/Local/Google/Chrome/User Data");