Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6945)

Unified Diff: chrome/test/chromedriver/chrome/javascript_dialog_manager.cc

Issue 2503533003: [chromedriver] Retry alert handling if HandleJavaScriptDialog fails. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/chrome/javascript_dialog_manager.cc
diff --git a/chrome/test/chromedriver/chrome/javascript_dialog_manager.cc b/chrome/test/chromedriver/chrome/javascript_dialog_manager.cc
index f95d5179f67a746f68054cf7e8cfd36b7a4b045e..3a8228563e7cb2939dfd94ed9082e329fdb3c869 100644
--- a/chrome/test/chromedriver/chrome/javascript_dialog_manager.cc
+++ b/chrome/test/chromedriver/chrome/javascript_dialog_manager.cc
@@ -37,6 +37,13 @@ Status JavaScriptDialogManager::HandleDialog(bool accept,
if (text)
params.SetString("promptText", *text);
Status status = client_->SendCommand("Page.handleJavaScriptDialog", params);
+ std::string msg = status.message();
+ // Retry handling the alert dialog if
+ // JavaScriptDialogManager::HandleJavaScriptDialog function fails.
samuong 2016/11/16 19:06:05 This comment doesn't add much, I don't think it's
gmanikpure 2016/11/16 20:22:40 ok.I will remove it.
+ if (status.IsError() && (msg.find("Could not handle JavaScript dialog") !=
+ std::string::npos)) {
samuong 2016/11/16 19:06:04 This isn't a very specific error message (it gets
gmanikpure 2016/11/16 20:22:40 Oh ok, the response received is :- "[38.955][DEBUG
samuong 2016/11/16 21:04:04 You can just check "status.IsError()", this should
gmanikpure 2016/11/16 21:26:45 Done.Please take a look.
+ status = client_->SendCommand("Page.handleJavaScriptDialog", params);
+ }
samuong 2016/11/16 19:06:04 nit: don't need braces for a single-line if body
gmanikpure 2016/11/16 20:22:40 oops, sorry. I had some logging statements inside
if (status.IsError())
return status;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698