--- a/testing/webdriver/src/capabilities.rs
+++ b/testing/webdriver/src/capabilities.rs
@@ -82,17 +82,17 @@ impl SpecNewSessionParameters {
for key in null_entries {
capabilities.remove(&key);
}
for (key, value) in capabilities.iter() {
match &**key {
"acceptInsecureCerts" => if !value.is_boolean() {
return Err(WebDriverError::new(ErrorStatus::InvalidArgument,
- "acceptInsecureCerts was not a boolean"))
+ "acceptInsecureCerts is not a boolean"))
},
x @ "browserName" |
x @ "browserVersion" |
x @ "platformName" => if !value.is_string() {
return Err(WebDriverError::new(ErrorStatus::InvalidArgument,
format!("{} is not a string", x)))
},
"pageLoadStrategy" => {
@@ -105,17 +105,17 @@ impl SpecNewSessionParameters {
try!(SpecNewSessionParameters::validate_timeouts(value))
},
"unhandledPromptBehavior" => {
try!(SpecNewSessionParameters::validate_unhandled_prompt_behaviour(value))
}
x => {
if !x.contains(":") {
return Err(WebDriverError::new(ErrorStatus::InvalidArgument,
- format!("{} was not a the name of a known capability or a valid extension capability", x)))
+ format!("{} is not a the name of a known capability or a valid extension capability", x)))
} else {
try!(browser_capabilities.validate_custom(x, value));
}
}
}
}
Ok(capabilities)
}
@@ -130,84 +130,84 @@ impl SpecNewSessionParameters {
x => {
return Err(WebDriverError::new(
ErrorStatus::InvalidArgument,
format!("\"{}\" not a valid page load strategy", x)))
}
}
}
_ => return Err(WebDriverError::new(ErrorStatus::InvalidArgument,
- "pageLoadStrategy was not a string"))
+ "pageLoadStrategy is not a string"))
}
Ok(())
}
fn validate_proxy(proxy_value: &Json) -> WebDriverResult<()> {
let obj = try_opt!(proxy_value.as_object(),
ErrorStatus::InvalidArgument,
- "proxy was not an object");
+ "proxy is not an object");
for (key, value) in obj.iter() {
match &**key {
"proxyType" => match value.as_string() {
Some("pac") |
Some("direct") |
Some("autodetect") |
Some("system") |
Some("manual") => {},
Some(x) => return Err(WebDriverError::new(
ErrorStatus::InvalidArgument,
- format!("{} was not a valid proxyType value", x))),
+ format!("{} is not a valid proxyType value", x))),
None => return Err(WebDriverError::new(
ErrorStatus::InvalidArgument,
- "proxyType value was not a string")),
+ "proxyType value is not a string")),
},
"proxyAutoconfigUrl" => match value.as_string() {
Some(x) => {
try!(Url::parse(x).or(Err(WebDriverError::new(
ErrorStatus::InvalidArgument,
- "proxyAutoconfigUrl was not a valid url"))));
+ "proxyAutoconfigUrl is not a valid url"))));
},
None => return Err(WebDriverError::new(
ErrorStatus::InvalidArgument,
- "proxyAutoconfigUrl was not a string"
+ "proxyAutoconfigUrl is not a string"
))
},
"ftpProxy" => try!(SpecNewSessionParameters::validate_host(value)),
"httpProxy" => try!(SpecNewSessionParameters::validate_host(value)),
"noProxy" => try!(SpecNewSessionParameters::validate_no_proxy(value)),
"sslProxy" => try!(SpecNewSessionParameters::validate_host(value)),
"socksProxy" => try!(SpecNewSessionParameters::validate_host(value)),
"socksVersion" => if !value.is_number() {
return Err(WebDriverError::new(ErrorStatus::InvalidArgument,
- "socksVersion was not a number"))
+ "socksVersion is not a number"))
},
x => return Err(WebDriverError::new(
ErrorStatus::InvalidArgument,
- format!("{} was not a valid proxy configuration capability", x)))
+ format!("{} is not a valid proxy configuration capability", x)))
}
}
Ok(())
}
fn validate_no_proxy(value: &Json) -> WebDriverResult<()> {
match value.as_array() {
Some(hosts) => {
for host in hosts {
match host.as_string() {
Some(_) => {},
None => return Err(WebDriverError::new(
ErrorStatus::InvalidArgument,
- format!("{} was not a string", host)
+ format!("{} is not a string", host)
))
}
}
},
None => return Err(WebDriverError::new(
ErrorStatus::InvalidArgument,
- format!("{} was not an array", value)
+ format!("{} is not an array", value)
))
}
Ok(())
}
/// Validate whether a named capability is JSON value is a string containing a host
/// and possible port
@@ -228,69 +228,69 @@ impl SpecNewSessionParameters {
if url.username() != "" ||
url.password() != None ||
url.path() != "/" ||
url.query() != None ||
url.fragment() != None {
return Err(WebDriverError::new(
ErrorStatus::InvalidArgument,
- format!("{} was not of the form host[:port]", host)));
+ format!("{} is not of the form host[:port]", host)));
}
},
None => return Err(WebDriverError::new(
ErrorStatus::InvalidArgument,
- format!("{} was not a string", value)
+ format!("{} is not a string", value)
))
}
Ok(())
}
fn validate_timeouts(value: &Json) -> WebDriverResult<()> {
let obj = try_opt!(value.as_object(),
ErrorStatus::InvalidArgument,
- "timeouts capability was not an object");
+ "timeouts capability is not an object");
for (key, value) in obj.iter() {
match &**key {
x @ "script" |
x @ "pageLoad" |
x @ "implicit" => {
let timeout = try_opt!(value.as_i64(),
ErrorStatus::InvalidArgument,
- format!("{} timeouts value was not an integer", x));
+ format!("{} timeouts value is not an integer", x));
if timeout < 0 {
return Err(WebDriverError::new(ErrorStatus::InvalidArgument,
- format!("{} timeouts value was negative", x)))
+ format!("{} timeouts value is negative", x)))
}
},
x => return Err(WebDriverError::new(ErrorStatus::InvalidArgument,
- format!("{} was not a valid timeouts capability", x)))
+ format!("{} is not a valid timeouts capability", x)))
}
}
Ok(())
}
fn validate_unhandled_prompt_behaviour(value: &Json) -> WebDriverResult<()> {
let behaviour = try_opt!(value.as_string(),
ErrorStatus::InvalidArgument,
- "unhandledPromptBehavior capability was not a string");
+ "unhandledPromptBehavior capability is not a string");
match behaviour {
"dismiss" |
"accept" => {},
x => return Err(WebDriverError::new(ErrorStatus::InvalidArgument,
- format!("{} was not a valid unhandledPromptBehavior value", x))) }
+ format!("{} is not a valid unhandledPromptBehavior value", x))) }
Ok(())
}
}
impl Parameters for SpecNewSessionParameters {
fn from_json(body: &Json) -> WebDriverResult<SpecNewSessionParameters> {
let data = try_opt!(body.as_object(),
ErrorStatus::UnknownError,
- "Message body was not an object");
+ "Message body is not an object");
let capabilities = try_opt!(
try_opt!(data.get("capabilities"),
ErrorStatus::InvalidArgument,
"Missing 'capabilities' parameter").as_object(),
ErrorStatus::InvalidArgument,
"'capabilities' parameter is not an object");
@@ -466,17 +466,17 @@ impl CapabilitiesMatching for LegacyNewS
Ok(Some(capabilities))
}
}
impl Parameters for LegacyNewSessionParameters {
fn from_json(body: &Json) -> WebDriverResult<LegacyNewSessionParameters> {
let data = try_opt!(body.as_object(),
ErrorStatus::UnknownError,
- "Message body was not an object");
+ "Message body is not an object");
let desired_capabilities =
if let Some(capabilities) = data.get("desiredCapabilities") {
try_opt!(capabilities.as_object(),
ErrorStatus::InvalidArgument,
"'desiredCapabilities' parameter is not an object").clone()
} else {
BTreeMap::new()