Flash object screenshot Firefox disables shockwave flash plugin option to "Never Active" and "Block dangerous and intrusive Flash content" option is selected while running scripts through selenium webdriver. Because of it, unable to click on Flash objects.
I have tried below options but didn't work for me.
I used following code to click on the Flash object:
public PublicDocuments UploadNew(string fileToUpload)
{
try
{
Wait.ForLoading(waitTime.SMALL);
page.Element("//object[@id='SWFUpload_0']", locateBy.XPATH).GetOne().Click();
// IWebElement we = driver.FindElement(By.XPath("//object[@id='SWFUpload_0']"));
// Point point = we.Location;
//int xcord = point.X;
//Console.WriteLine(xcord);
//int ycord = point.Y;
// Debug.WriteLine("ycord is:"+ycord);
// // IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
// ////js.ExecuteScript(args[0].Click(); ", we);
// Actions builder = new Actions(driver);
// builder.MoveToElement(driver.FindElement(By.XPath("//object[@id='SWFUpload_0']")), 3, 126).ClickAndHold().Build().Perform();
}
Is there any other alternatives to click/enable Flash objects?
1/ using firefox.exe -p create manualy new firefox profile 2/ run firefox with the new profile 3/ set the profile as you wish
use this code to run test in custumized profile:
FirefoxOptions options = new FirefoxOptions();
ProfilesIni allProfiles = new ProfilesIni();
FirefoxProfile selenium_profile = allProfiles.getProfile("selenium_profile");
options.setProfile(selenium_profile);
options.setBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
System.setProperty("webdriver.gecko.driver", "C:\\Users\\pburgr\\Desktop\\geckodriver-v0.20.0-win64\\geckodriver.exe");
driver = new FirefoxDriver(options);
driver.manage().window().maximize();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.