Commit 9b69b0c6 authored by Tatiana Buldina's avatar Tatiana Buldina Committed by Commit Bot

[ChromeDriver] Add validation of locator in FindElement function in w3c mode

Bug: chromedriver:2677
Change-Id: I77946071bac5c924e2c56745f93309cada417fae
Reviewed-on: https://chromium-review.googlesource.com/c/1358510Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Commit-Queue: Tatiana Buldina <buldina@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613286}
parent 32a2d739
......@@ -273,6 +273,14 @@ Status FindElement(int interval_ms,
std::string strategy;
if (!params.GetString("using", &strategy))
return Status(kInvalidArgument, "'using' must be a string");
if (session->w3c_compliant &&
strategy != "css selector" &&
strategy != "link text" &&
strategy != "partial link text" &&
strategy != "tag name" &&
strategy != "xpath")
return Status(kInvalidArgument, "invalid locator");
std::string target;
if (!params.GetString("value", &target))
return Status(kInvalidArgument, "'value' must be a string");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment