Mrunal Gosar
Mrunal Gosar

Reputation: 4683

Fullscreen operation is not working in selenium webdriver 3.x

Firefox Version: 52.0.2 (32-bit)
Platform: Windows 7
Selenium Webdriver version: 3.4.0 (Java bindings)
Problem statement: While trying to perform full screen operation in firefox browser then it throws UnsupportedCommandException

Test Code:

public class GeckoTest {
    public static void main(String[] args) throws IOException {
        System.setProperty("webdriver.gecko.driver","<geckodriver executable>");
        FirefoxBinary binary = new FirefoxBinary(new File("firefox binary"));
        FirefoxOptions options = new FirefoxOptions();
        options.setBinary(binary);
        options.setLogLevel(Level.ALL);
        WebDriver browser = new FirefoxDriver(options);
        browser.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
        browser.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
        browser.get("http://examples.sencha.com/extjs/6.5.0/examples/kitchensink/?classic#form-fieldtypes");
        browser.manage().window().fullscreen();
        WebDriverWait wait = new WebDriverWait(browser,20,3000);
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//div[contains(@class,'x-form-spinner x-form-spinner-default x-form-spinner-down x-form-spinner-down-default')]")));
        Actions builder = new Actions(browser);
        builder.doubleClick(browser.findElement(By.xpath(".//div[contains(@class,'x-form-spinner x-form-spinner-default x-form-spinner-down x-form-spinner-down-default')]"))).perform();
        browser.close();
    }
}

EDIT: It seems this is an known issue and will be fixed in FF55 as per this enter link description here

Upvotes: 2

Views: 964

Answers (1)

undetected Selenium
undetected Selenium

Reputation: 193308

While you work with Selenium 3.4.x, geckodriver v0.16.1 and Mozilla Firefox 53.0, as you mentioned when we try to perform full screen operation in Mozilla Firefox browser then it throws UnsupportedCommandException is true. How ever there is an alternative to achieve the full screen operation in Mozilla Firefox which works perfect through sending F11 Keys. Here is the minimal code block to check full screen operation in Mozilla Firefox:

System.setProperty("webdriver.gecko.driver", "C:\\your_directory\\geckodriver.exe");
WebDriver browser = new FirefoxDriver();
browser.get("http://examples.sencha.com/extjs/6.5.0/examples/kitchensink/?classic#form-fieldtypes");
browser.findElement(By.tagName("body")).sendKeys(Keys.F11);

Upvotes: 2

Related Questions