webdriver: Merge pull request #21 from AutomatedTester/get_page_source
authorAutomatedTester <david.burns@theautomatedtester.co.uk>
Tue, 19 Jan 2016 15:29:04 +0000
changeset 428054 369b5a7c6050951e4f11fbf4b939de4f7ac77bed
parent 428053 2571871b62eddafbb98809e8d04579c9904a9d1b
child 428055 834fbded058703fc6f9bede3e356538efa2ca582
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
webdriver: Merge pull request #21 from AutomatedTester/get_page_source Add in endpoint for GetPageSource Source-Repo: https://github.com/mozilla/webdriver-rust Source-Revision: 04ea4331c409f6925faba9dbc41a44dbcc04e7a2
testing/webdriver/src/command.rs
testing/webdriver/src/httpapi.rs
--- a/testing/webdriver/src/command.rs
+++ b/testing/webdriver/src/command.rs
@@ -12,16 +12,17 @@ pub enum WebDriverCommand<T: WebDriverEx
     NewSession,
     DeleteSession,
     Get(GetParameters),
     GetCurrentUrl,
     GoBack,
     GoForward,
     Refresh,
     GetTitle,
+    GetPageSource,
     GetWindowHandle,
     GetWindowHandles,
     Close,
     SetWindowSize(WindowSizeParameters),
     GetWindowSize,
     MaximizeWindow,
 //    FullscreenWindow // Not supported in marionette
     SwitchToWindow(SwitchToWindowParameters),
@@ -113,16 +114,17 @@ impl <U: WebDriverExtensionRoute> WebDri
                 let parameters: GetParameters = try!(Parameters::from_json(&body_data));
                 WebDriverCommand::Get(parameters)
             },
             Route::GetCurrentUrl => WebDriverCommand::GetCurrentUrl,
             Route::GoBack => WebDriverCommand::GoBack,
             Route::GoForward => WebDriverCommand::GoForward,
             Route::Refresh => WebDriverCommand::Refresh,
             Route::GetTitle => WebDriverCommand::GetTitle,
+            Route::GetPageSource => WebDriverCommand::GetPageSource,
             Route::GetWindowHandle => WebDriverCommand::GetWindowHandle,
             Route::GetWindowHandles => WebDriverCommand::GetWindowHandles,
             Route::Close => WebDriverCommand::Close,
             Route::SetTimeouts => {
                 let parameters: TimeoutsParameters = try!(Parameters::from_json(&body_data));
                 WebDriverCommand::SetTimeouts(parameters)
             },
             Route::SetWindowSize => {
@@ -314,19 +316,19 @@ impl <U: WebDriverExtensionRoute> WebDri
 
 impl <U:WebDriverExtensionRoute> ToJson for WebDriverMessage<U> {
     fn to_json(&self) -> Json {
         let mut data = BTreeMap::new();
         let parameters = match self.command {
             WebDriverCommand::NewSession |
             WebDriverCommand::DeleteSession | WebDriverCommand::GetCurrentUrl |
             WebDriverCommand::GoBack | WebDriverCommand::GoForward | WebDriverCommand::Refresh |
-            WebDriverCommand::GetTitle | WebDriverCommand::GetWindowHandle |
-            WebDriverCommand::GetWindowHandles | WebDriverCommand::Close |
-            WebDriverCommand::GetWindowSize | WebDriverCommand::MaximizeWindow |
+            WebDriverCommand::GetTitle | WebDriverCommand::GetPageSource |
+            WebDriverCommand::GetWindowHandle | WebDriverCommand::GetWindowHandles |
+            WebDriverCommand::Close | WebDriverCommand::GetWindowSize | WebDriverCommand::MaximizeWindow |
             WebDriverCommand::SwitchToParentFrame | WebDriverCommand::GetActiveElement |
             WebDriverCommand::IsDisplayed(_) | WebDriverCommand::IsSelected(_) |
             WebDriverCommand::GetElementAttribute(_, _) | WebDriverCommand::GetCSSValue(_, _) |
             WebDriverCommand::GetElementText(_) | WebDriverCommand::GetElementTagName(_) |
             WebDriverCommand::GetElementRect(_) | WebDriverCommand::IsEnabled(_) |
             WebDriverCommand::GetCookies | WebDriverCommand::GetCookie(_) |
             WebDriverCommand::DeleteCookies | WebDriverCommand::DeleteCookie(_) |
             WebDriverCommand::DismissAlert | WebDriverCommand::AcceptAlert |
--- a/testing/webdriver/src/httpapi.rs
+++ b/testing/webdriver/src/httpapi.rs
@@ -12,16 +12,17 @@ fn standard_routes<U:WebDriverExtensionR
     return vec![(Post, "/session", Route::NewSession),
                 (Delete, "/session/{sessionId}", Route::DeleteSession),
                 (Post, "/session/{sessionId}/url", Route::Get),
                 (Get, "/session/{sessionId}/url", Route::GetCurrentUrl),
                 (Post, "/session/{sessionId}/back", Route::GoBack),
                 (Post, "/session/{sessionId}/forward", Route::GoForward),
                 (Post, "/session/{sessionId}/refresh", Route::Refresh),
                 (Get, "/session/{sessionId}/title", Route::GetTitle),
+                (Get, "/session/{sessionId}/source", Route::GetPageSource),
                 (Get, "/session/{sessionId}/window", Route::GetWindowHandle),
                 (Get, "/session/{sessionId}/window/handles", Route::GetWindowHandles),
                 (Delete, "/session/{sessionId}/window", Route::Close),
                 (Post, "/session/{sessionId}/window/size", Route::SetWindowSize),
                 (Get, "/session/{sessionId}/window/size", Route::GetWindowSize),
                 (Post, "/session/{sessionId}/window/maximize", Route::MaximizeWindow),
                 (Post, "/session/{sessionId}/window", Route::SwitchToWindow),
                 (Post, "/session/{sessionId}/frame", Route::SwitchToFrame),
@@ -75,16 +76,17 @@ pub enum Route<U:WebDriverExtensionRoute
     NewSession,
     DeleteSession,
     Get,
     GetCurrentUrl,
     GoBack,
     GoForward,
     Refresh,
     GetTitle,
+    GetPageSource,
     GetWindowHandle,
     GetWindowHandles,
     Close,
     SetWindowSize,
     GetWindowSize,
     MaximizeWindow,
     SwitchToWindow,
     SwitchToFrame,