Reputation: 25
driver.manage().window().maximize();
Upvotes: 1
Views: 601
Reputation: 319
Each call of the method usually returns the same object which has been calling it (like return this
), allowing to call other methods on the same object. It can however return other objects which can also be method-chained or even void if it is a terminal method.
Upvotes: 1
Reputation: 45906
This is known as method chaining, as stated in Thibstars' answer. In your case it's a more concise way of writing:
WebDriver driver = ...; // get instance from somewhere
WebDriver.Options options = driver.manage();
WebDriver.Window window = options.window();
window.maximize();
Note: The class types are assumed based on the selenium tag and method names.
Upvotes: 2