Difference between webdriver.get() and webdriver.n

2020-01-27 01:00发布

What is the difference between get() and navigate() methods? Does any of this or maybe another method waits for page content to load? What do I really need is something like Selenium 1.0's WaitForPageToLoad but for using via webdriver.

Any suggestions?

13条回答
戒情不戒烟
2楼-- · 2020-01-27 01:47

As per the javadoc for get(), it is the synonym for Navigate.to()

View javadoc screenshot below:

javadoc screenshot

Javadoc for get() says it all -

Load a new web page in the current browser window. This is done using an HTTP GET operation, and the method will block until the load is complete. This will follow redirects issued either by the server or as a meta-redirect from within the returned HTML. Should a meta-redirect "rest" for any duration of time, it is best to wait until this timeout is over, since should the underlying page change whilst your test is executing the results of future calls against this interface will be against the freshly loaded page. Synonym for org.openqa.selenium.WebDriver.Navigation.to(String).

查看更多
登录 后发表回答