Skip to content

Commit 7ebbae6

Browse files
authored
Merge branch 'trunk' into feature/driver-session-ruby
2 parents 2bbed0c + 9a5225c commit 7ebbae6

36 files changed

+478
-557
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,49 @@
1+
using System;
12
using Microsoft.VisualStudio.TestTools.UnitTesting;
2-
3+
using OpenQA.Selenium;
4+
using OpenQA.Selenium.Chrome;
5+
using System.Collections.Generic;
36
namespace SeleniumDocs.Interactions
47
{
58
[TestClass]
6-
public class WindowsTest : BaseTest
9+
public class WindowsTest
710
{
11+
[TestMethod]
12+
public void TestWindowCommands()
13+
{
14+
WebDriver driver = new ChromeDriver();
15+
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromMilliseconds(500);
16+
17+
// Navigate to Url
18+
driver.Url="https://www.selenium.dev/selenium/web/window_switching_tests/page_with_frame.html";
19+
//fetch handle of this
20+
String currHandle = driver.CurrentWindowHandle;
21+
Assert.IsNotNull(currHandle);
22+
23+
//click on link to open a new window
24+
driver.FindElement(By.LinkText("Open new window")).Click();
25+
//fetch handles of all windows, there will be two, [0]- default, [1] - new window
26+
IList<string> windowHandles = new List<string>(driver.WindowHandles);
27+
driver.SwitchTo().Window(windowHandles[1]);
28+
//assert on title of new window
29+
String title = driver.Title;
30+
Assert.AreEqual("Simple Page", title);
31+
32+
//closing current window
33+
driver.Close();
34+
//Switch back to the old tab or window
35+
driver.SwitchTo().Window(windowHandles[0]);
36+
37+
//Opens a new tab and switches to new tab
38+
driver.SwitchTo().NewWindow(WindowType.Tab);
39+
Assert.AreEqual("", driver.Title);
40+
41+
//Opens a new window and switches to new window
42+
driver.SwitchTo().NewWindow(WindowType.Window);
43+
Assert.AreEqual("", driver.Title);
44+
45+
//quitting driver
46+
driver.Quit(); //close all windows
47+
}
848
}
9-
}
49+
}

examples/dotnet/SeleniumDocs/SeleniumDocs.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<ItemGroup>
99
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
10-
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="7.6.0" />
10+
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="7.6.2" />
1111
<PackageReference Include="MSTest.TestAdapter" Version="3.4.3" />
1212
<PackageReference Include="MSTest.TestFramework" Version="3.4.3" />
1313
<PackageReference Include="Selenium.Support" Version="4.21.0" />

examples/java/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ repositories {
1010
}
1111

1212
dependencies {
13-
testImplementation 'org.seleniumhq.selenium:selenium-java:4.21.0'
14-
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
13+
testImplementation 'org.seleniumhq.selenium:selenium-java:4.22.0'
14+
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.3'
1515
}
1616

1717
test {

examples/java/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

examples/java/gradlew

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.

examples/java/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<dependency>
4141
<groupId>org.junit.jupiter</groupId>
4242
<artifactId>junit-jupiter-engine</artifactId>
43-
<version>5.10.2</version>
43+
<version>5.10.3</version>
4444
<scope>test</scope>
4545
</dependency>
4646
<dependency>
@@ -55,7 +55,7 @@
5555
<plugin>
5656
<groupId>org.apache.maven.plugins</groupId>
5757
<artifactId>maven-surefire-plugin</artifactId>
58-
<version>3.2.5</version>
58+
<version>3.3.0</version>
5959
<configuration>
6060
<properties>
6161
<configurationParameters>

0 commit comments

Comments
 (0)