我想做的是在下面提到的Chrome设置页面中将flash设置从“阻止”更改为“允许”。我在xpath中查找了flash的sel下拉选项,以运行Webdriver代码,但根本没有选择该元素。
WebDriver driver = new ChromeDriver();
String flashURL = "chrome://settings/content/siteDetails?site=https%3A%2F%2Fwww.xfinity.com";
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
driver.get(flashURL);
//copy the xpath for flash sel drop down: //*[@id="permission"]
WebElement flash = driver.findElement(By.xpath("//*[@id="permission"]"));
flash.click();
运行程序时,出现错误消息,提示未找到Web元素。
我使用的是Chrome 78,并已安装相应的chromedriver。