setSize()
As per the Java Docs setSize() sets the size of the current browsing window. This command will change the outer window dimension along with the view port and is defined as:
void setSize(Dimension targetSize)
Set the size of the current window. This will change the outer window dimension, not just the view port, synonymous to window.resizeTo() in JS.
Parameters:
targetSize - The target size.
where Dimension implies a Point which is defined as:
Dimension(int width, int height)
So by the line of code:
driver.manage().window().setSize(new Dimension(1024, 768));
You are setting the size of the Viewport with width
set as 1024
and height
set as 768
for the current web browsing context.