0

Which one is the better to use?

driver.get("http://google.com");
driver.navigate().to("http://google.com");

Please suggest me

2 Answers2

2

The two methods are aliases of one another. There is no functional difference.

JimEvans
  • 27,201
  • 7
  • 83
  • 108
0

Just like JimEvans said, they are the same. The only differences are described here:

driver.navigate().to("http://www.example.com");

To reiterate: "navigate().to()" and "get()" do exactly the same thing. One's just a lot easier to type than the other!

The "navigate" interface also exposes the ability to move backwards and forwards in your browser's history:

driver.navigate().forward();
driver.navigate().back();

Please be aware that this functionality depends entirely on the underlying browser. It's just possible that something unexpected may happen when you call these methods if you're used to the behaviour of one browser over another.

http://code.google.com/p/selenium/wiki/NextSteps

Arek
  • 1,941
  • 4
  • 22
  • 27