Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for opening new browser windows in .NET
Since support has been added to the W3C WebDriver Specification for creating a new top-level browser context (a "new tab" or "new window"), this change implements the new command in the .NET language bindings. The method creates a new browser tab/window and switches to it. As an argument, the method takes a type hint to indicate what type of browser context the user wants (a tab or a window). Example usage: driver.SwitchTo().NewWindow(WindowType.Tab); Note carefully, however, this type hint is only a suggestion. If a browser driver does not support creating new top-level browsers of the type desired by the user, it will still create the new top-level browser using whatever type it does support. This is perfectly compliant with the specification language for this command. As a concrete example, at the time of this commit, executing the above sample code against the IE driver will create a new top-level browser context, but as a window, not a tab, in spite of the fact that a new tab was explicitly requested. Even though the browser itself supports creation of new tabs, the driver does not. This will not be considered a valid bug, and issue reports claiming it is so will be summarily closed, possibly without comment.
- Loading branch information
Showing
7 changed files
with
115 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// <copyright file="WindowType.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> | ||
/// Represents the type of a new browser window that may be created | ||
/// </summary> | ||
public enum WindowType | ||
{ | ||
/// <summary> | ||
/// Create a new browser window using a new top-level window. | ||
/// </summary> | ||
Window, | ||
|
||
/// <summary> | ||
/// Create a new browser window using a new tab. | ||
/// </summary> | ||
Tab | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters