Reputation: 1125
I am confused with this. Basically when we create an object of a class, then we can access property
or method
. Up to I am fine. But what when we are creating an object of WebDriver
class in Selenium
and setting URL through driver.navigate().to()
. So Why are here two things navigate()
and to()
after the Selenium object driver
.
Upvotes: 2
Views: 1090
Reputation: 5204
Navigate is an interface to navigate through the browser:
Navigate is a way of interacting with the browser.
The method .to()
is a function of the interface to get a URL.
The shorter way to do driver.navigate().to()
is driver.get()
With navigate
you have more methods like: driver.navigate().forward();
and driver.navigate().back();
Hope this helps you!
PS:
As @muraliselenium has commented if your question is about "method chaining" you can read more about it here
Upvotes: 2