Index: chrome/test/webdriver/webdriver_session.cc |
diff --git a/chrome/test/webdriver/webdriver_session.cc b/chrome/test/webdriver/webdriver_session.cc |
index efd7b1ef6e6d651550b9e9430c5937a893250ee3..6578a400adc3a7a4ea43b6dcc3779a116ef8c247 100644 |
--- a/chrome/test/webdriver/webdriver_session.cc |
+++ b/chrome/test/webdriver/webdriver_session.cc |
@@ -93,15 +93,20 @@ Error* Session::Init(const Automation::BrowserOptions& options) { |
} |
Error* Session::BeforeExecuteCommand() { |
+ Error* error = AfterExecuteCommand(); |
+ if (!error) { |
+ error = SwitchToTopFrameIfCurrentFrameInvalid(); |
+ } |
+ return error; |
+} |
+ |
+Error* Session::AfterExecuteCommand() { |
Error* error = NULL; |
if (!options_.load_async) { |
LOG(INFO) << "Waiting for the page to stop loading"; |
error = WaitForAllTabsToStopLoading(); |
LOG(INFO) << "Done waiting for the page to stop loading"; |
} |
- if (!error) { |
- error = SwitchToTopFrameIfCurrentFrameInvalid(); |
- } |
return error; |
} |