send F11 with selenium webdriver

2,853 views
Skip to first unread message

ama...@bufetedemarketing.com

unread,
Aug 7, 2017, 7:42:43 AM8/7/17
to Selenium Users
Hi guys!

How could I maximize the window with Selenium Webdriver?? I want to simulate the "F11" action, but I'm not able to do it.

I've tried the following without luck:

          

1. driver.findElement(By.tagName("body")).sendKeys(Keys.F11);  
    Thread.sleep(5000);
    driver.findElement(By.tagName("body")).sendKeys(Keys.F5);    //this option doesn't work with Firefox and geckodriver Marionette.

 
2. driver.manage().window.setSize(1152,864);           //this doesn't compile
 
3. driver.findElement(driver.findElement(By.xpath("/html/body")).sendKeys(driver.Key.F11));    //this doesn't compile


Any ideas?

Thanks so much!! 

ama...@bufetedemarketing.com

unread,
Aug 7, 2017, 7:46:27 AM8/7/17
to Selenium Users
Hi guys!

How could I maximize the window with Selenium Webdriver?? I want to simulate the "F11" action, but I'm not able to do it.

I've tried the following without luck:

          

1. driver.findElement(By.tagName("body")).sendKeys(Keys.F11);  
    Thread.sleep(5000);
    driver.findElement(By.tagName("body")).sendKeys(Keys.F5);    //this option doesn't work with Firefox and geckodriver Marionette.

 
2. driver.manage().window.setSize(1152,864);           //this doesn't compile
 
3. driver.findElement(By.xpath("/html/body")).sendKeys(driver.Key.F11);    //this doesn't compile

   4. driver.manage().window().maximize();    //this option doesn't do anything

Andreas Tolfsen

unread,
Aug 7, 2017, 7:55:17 AM8/7/17
to seleniu...@googlegroups.com
Also sprach ama...@bufetedemarketing.com:

> How could I maximize the window with Selenium Webdriver?? I want
> to simulate the "F11" action, but I'm not able to do it.

WebDriver doesn’t let you interact with the surrounding
environment. It is limited to the web content.

To maximize the window, you can call the
driver.manage().window().maximize() method in the Java API, but
WebDriver conforming implementions also have a Fullscreen Window
command. Not sure if this is exposed in the Java API yet, but file
a bug if it isn’t. It should just work with geckodriver.

Bharadwaj Pendyala

unread,
Aug 7, 2017, 10:30:11 PM8/7/17
to Selenium Users
Could you share more details on why it isn't compiling? 

Alternate suggestion would be try using Robot class with Key press and key release events of F11. Please let us know in case if that works :) 

praveen kumar cherukuri

unread,
Aug 8, 2017, 9:16:47 AM8/8/17
to seleniu...@googlegroups.com
Hello All, 

Selenium library has a command to switch to "Full Screen" mode. 

try out this option at browser instance level. 


driver.manage().window().fullscreen();




photo 
Praveen Kumar Cherukuri
Test Automation ExpertQA-Masters 
pra...@qa-masters.com | Skype:  praveen_cherukuri |
 www.qa-masters.com | Trainers Outsourcing | Experts in QA Training | Technical Project Support


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/920ece11-eff5-430b-9a85-842a15419500%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

ama...@bufetedemarketing.com

unread,
Aug 10, 2017, 3:06:23 AM8/10/17
to Selenium Users
Hi Praveen,

I've tried your option but it doesn't compile, it returns the following: org.openqa.selenium.WebDriverException: fullscreenWindow

What can be happening?

Thanks so much.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

ama...@bufetedemarketing.com

unread,
Aug 10, 2017, 3:08:31 AM8/10/17
to Selenium Users, a...@sny.no
Hi Andreas,

I tried with that: driver.manage().window().maximize() 
But it doesn't make any change... I use geckodriver. Why doesn't it work?

Thanks so much.

Serguei Kouzmine

unread,
Aug 11, 2017, 10:00:02 PM8/11/17
to Selenium Users
Please explore Robot

```
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;


try {
// press F11 key of keyboard to switch the browser to full screen
Robot robot = new Robot();
sleep(2000);
robot.keyPress(KeyEvent.VK_F11);
} catch (AWTException e) {
System.err.println("Exception (ignored) " + e.toString());
}

```

poobathy r

unread,
Aug 11, 2017, 10:11:23 PM8/11/17
to seleniu...@googlegroups.com
Robot might work... But please do a keyrelease once you do a keypress

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/1ac09f46-ed0b-4810-90d2-6be3a464f972%40googlegroups.com.

ama...@bufetedemarketing.com

unread,
Aug 14, 2017, 3:31:32 AM8/14/17
to Selenium Users
Perfect Poobathy! It works correctly!! 

Thanks so much!!!!!
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

jos...@embluemail.com

unread,
Sep 26, 2018, 5:18:50 AM9/26/18
to Selenium Users
Hello... I need the same things but in python.. Help Please
Reply all
Reply to author
Forward
0 new messages