Skip to content

Commit

Permalink
Add ISupportsPrint interface to .NET to allow use of Print method
Browse files Browse the repository at this point in the history
  • Loading branch information
jimevans committed Dec 6, 2020
1 parent fa6e369 commit 471ab75
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
33 changes: 33 additions & 0 deletions dotnet/src/webdriver/ISupportsPrint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// <copyright file="ISupportsPrint.cs" company="WebDriver Committers">
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>

namespace OpenQA.Selenium
{
/// <summary>
/// Interface allowing a driver implementation to generate a print representation of the page.
/// </summary>
public interface ISupportsPrint
{
/// <summary>
/// Gets a <see cref="PrintDocument"/> object representing a PDF-formatted print representation of the page.
/// </summary>
/// <param name="printOptions">A <see cref="PrintOptions"/> object describing the options of the printed document.</param>
/// <returns>The <see cref="PrintDocument"/> object containing the PDF-formatted print representation of the page.</returns>
PrintDocument Print(PrintOptions options);
}
}
8 changes: 4 additions & 4 deletions dotnet/src/webdriver/Remote/RemoteWebDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace OpenQA.Selenium.Remote
/// }
/// </code>
/// </example>
public class RemoteWebDriver : IWebDriver, ISearchContext, IJavaScriptExecutor, IFindsElement, ITakesScreenshot, IHasCapabilities, IActionExecutor, IHasCommandExecutor, IAllowsFileDetection, IHasSessionId, IHasWebStorage, IHasLocationContext, IHasApplicationCache, IFindsById, IFindsByClassName, IFindsByLinkText, IFindsByName, IFindsByTagName, IFindsByXPath, IFindsByPartialLinkText, IFindsByCssSelector
public class RemoteWebDriver : IWebDriver, ISearchContext, IJavaScriptExecutor, IFindsElement, ITakesScreenshot, ISupportsPrint, IActionExecutor, IHasCapabilities, IHasCommandExecutor, IAllowsFileDetection, IHasSessionId, IHasWebStorage, IHasLocationContext, IHasApplicationCache, IFindsById, IFindsByClassName, IFindsByLinkText, IFindsByName, IFindsByTagName, IFindsByXPath, IFindsByPartialLinkText, IFindsByCssSelector
{
/// <summary>
/// The default command timeout for HTTP requests in a RemoteWebDriver instance.
Expand Down Expand Up @@ -842,10 +842,10 @@ public Screenshot GetScreenshot()
}

/// <summary>
/// Gets a
/// Gets a <see cref="PrintDocument"/> object representing a PDF-formatted print representation of the page.
/// </summary>
/// <param name="printOptions"></param>
/// <returns></returns>
/// <param name="printOptions">A <see cref="PrintOptions"/> object describing the options of the printed document.</param>
/// <returns>The <see cref="PrintDocument"/> object containing the PDF-formatted print representation of the page.</returns>
public PrintDocument Print(PrintOptions printOptions)
{
Response commandResponse = this.Execute(DriverCommand.Print, printOptions.ToDictionary());
Expand Down

0 comments on commit 471ab75

Please sign in to comment.