How do I disable the loading of flash objects when using Selenium Remote WebDriver. It will be helpful if I get a solution for the normal webdriver also.
Since in most cases the Flash object is loaded by a JavaScript I have tried disabling the javascript on the webdriver and remote webdriver both, but it does not work.
I tried to to disable the JavaScript by:
WebDriver driver = new FirefoxDriver();
((DesiredCapabilities) driver.getCapabilities()).setJavascriptEnabled(false);
I also tried:
DesiredCapabilities caps = new DesiredCapabilities();
caps.setJavascriptEnabled(false);
WebDriver driver = new FireFoxDriver(caps);
For Remote WebDriver i tried:
final DesiredCapabilities firefoxCapability = DesiredCapabilities.firefox();
firefoxCapability.setJavascriptEnabled(false);
new RemoteWebDriver(new URL("http://" + windowsIP + ":4444/wd/hub"), firefoxCapability);
After execution of the above statement the remote server displays
Executing: [new session: <platform=ANY, javascriptEnabled=false, browserName=firefox, version=>] at URL:/session>
but still all the Javascript is executing on the pages the driver loads and the Flash is also loading.
Please help me : 1. how can stop the flash from loading. 2. need it on remote driver as I need to test the pages on IE, Firefox, Chrome. Hence loading the forefox profile will not work
Thank you for the help.
1) void dismiss() – The dismiss() method clicks on the “Cancel” button as soon as the pop up window appears. 2) void accept() – The accept() method clicks on the “Ok” button as soon as the pop up window appears. 3) String getText() – The getText() method returns the text displayed on the alert box.
close() closes only the current window on which Selenium is running automated tests. The WebDriver session, however, remains active. On the other hand, the driver. quit() method closes all browser windows and ends the WebDriver session.
Few of these methods are: isSelected(): Checks whether a radio button is selected or not. isDisplayed(): Checks whether a radion button is displayed on the web page or not. isEnabled(): Checks whether a radion button is enabled or not.
1. Selenium Remote Webdriver : It is an interface which is used to execute the browser automation and to execute assessments in a distributed environment or on a remote computing device. In other words, It is a class which implements the WebDriver interface and this action is performed on the remote server.
I used this code on Linux mint and it works:
FirefoxProfile profile= new FirefoxProfile();
profile.setPreference("plugin.state.flash", 0);
FirefoxDriver driver = new FirefoxDriver(profile);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With