Skip to content

Commit 9d1090f

Browse files
authored
Merge branch 'SeleniumHQ:trunk' into trunk
2 parents 4e9ebd5 + b9d1956 commit 9d1090f

File tree

143 files changed

+6144
-2442
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+6144
-2442
lines changed

.github/workflows/java-examples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
uses: actions/setup-java@v3
3838
with:
3939
distribution: 'temurin'
40-
java-version: 8
40+
java-version: 11
4141
- name: Run Tests
4242
uses: nick-invision/[email protected]
4343
with:

.github/workflows/ruby-examples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Set up Ruby
3737
uses: ruby/setup-ruby@v1
3838
with:
39-
ruby-version: 2.7
39+
ruby-version: 3.0
4040
bundler-cache: true
4141
- name: Install Gems
4242
working-directory: ./examples/ruby

build-site.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ set -e
55
SELENIUM_GITHUB_API_PULLS_URL=https://api.github.com/repos/SeleniumHQ/seleniumhq.github.io/pulls
66
SELENIUM_ACCEPT_HEADER="Accept: application/vnd.github+json"
77
SELENIUM_AUTH_HEADER="Authorization: Bearer ${SELENIUM_CI_TOKEN}"
8-
SELENIUM_EXAMPLES_BRANCH=trunk
98
SELENIUM_EXAMPLES_REPO=seleniumhq.github.io
109
SELENIUM_EXAMPLES_ORG=SeleniumHQ
1110

1211
if [[ "${GITHUB_ACTIONS}" = "true" ]]; then
1312
SELENIUM_EXAMPLES_BRANCH=${GITHUB_HEAD_REF}
1413
fi
1514

15+
1616
USE_BASE_URL_SITE=""
1717
if [[ "${NETLIFY}" = "true" ]]; then
1818
echo -e "\033[0;32mNetlify detected, deployment happening at ${DEPLOY_PRIME_URL}...\033[0m"
@@ -28,6 +28,11 @@ if [[ "${NETLIFY}" = "true" ]]; then
2828
fi
2929
fi
3030

31+
if [[ "${SELENIUM_EXAMPLES_BRANCH}" = "" ]]; then
32+
echo -e "\033[0;32mEmpty SELENIUM_EXAMPLES_BRANCH, setting to trunk...\033[0m"
33+
SELENIUM_EXAMPLES_BRANCH=trunk
34+
fi
35+
3136
echo -e "\033[0;32mDeleting Hugo previously generated directories...\033[0m"
3237
rm -rf website_and_docs/public
3338

examples/dotnet/SeleniumDocs/GettingStarted/InstallDriversTest.cs

Lines changed: 0 additions & 56 deletions
This file was deleted.

examples/dotnet/SeleniumDocs/SeleniumDocs.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
1212
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
1313
<PackageReference Include="Selenium.Support" Version="4.5.0" />
14-
<PackageReference Include="Selenium.WebDriver" Version="4.8.1" />
15-
<PackageReference Include="WebDriverManager" Version="2.16.0" />
14+
<PackageReference Include="Selenium.WebDriver" Version="4.9.0" />
1615
</ItemGroup>
1716

1817
<ItemGroup>
1918
<Folder Include="LocalPackages" />
2019
</ItemGroup>
2120

22-
</Project>
21+
</Project>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
using System;
2+
using System.Threading;
3+
using Microsoft.VisualStudio.TestTools.UnitTesting;
4+
using OpenQA.Selenium;
5+
using OpenQA.Selenium.Support.UI;
6+
7+
namespace SeleniumDocs.Waits
8+
{
9+
[TestClass]
10+
public class WaitsTest : BaseChromeTest
11+
{
12+
[TestMethod]
13+
public void Fails()
14+
{
15+
driver.Url = "https://www.selenium.dev/selenium/web/dynamic.html";
16+
driver.FindElement(By.Id("adder")).Click();
17+
18+
Assert.ThrowsException<NoSuchElementException>(
19+
() => driver.FindElement(By.Id("box0"))
20+
);
21+
}
22+
23+
[TestMethod]
24+
public void Sleep()
25+
{
26+
driver.Url = "https://www.selenium.dev/selenium/web/dynamic.html";
27+
driver.FindElement(By.Id("adder")).Click();
28+
29+
Thread.Sleep(1000);
30+
31+
IWebElement added = driver.FindElement(By.Id("box0"));
32+
33+
Assert.AreEqual("redbox", added.GetDomAttribute("class"));
34+
}
35+
36+
[TestMethod]
37+
public void Implicit()
38+
{
39+
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(2);
40+
41+
driver.Url = "https://www.selenium.dev/selenium/web/dynamic.html";
42+
driver.FindElement(By.Id("adder")).Click();
43+
44+
IWebElement added = driver.FindElement(By.Id("box0"));
45+
46+
Assert.AreEqual("redbox", added.GetDomAttribute("class"));
47+
}
48+
49+
[TestMethod]
50+
public void Explicit()
51+
{
52+
driver.Url = "https://www.selenium.dev/selenium/web/dynamic.html";
53+
IWebElement revealed = driver.FindElement(By.Id("revealed"));
54+
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(2));
55+
56+
driver.FindElement(By.Id("reveal")).Click();
57+
wait.Until(d => revealed.Displayed);
58+
59+
revealed.SendKeys("Displayed");
60+
Assert.AreEqual("Displayed", revealed.GetDomProperty("value"));
61+
}
62+
63+
[TestMethod]
64+
public void ExplicitOptions()
65+
{
66+
driver.Url = "https://www.selenium.dev/selenium/web/dynamic.html";
67+
IWebElement revealed = driver.FindElement(By.Id("revealed"));
68+
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(2))
69+
{
70+
PollingInterval = TimeSpan.FromMilliseconds(300),
71+
};
72+
wait.IgnoreExceptionTypes(typeof(ElementNotInteractableException));
73+
74+
driver.FindElement(By.Id("reveal")).Click();
75+
wait.Until(d => {
76+
revealed.SendKeys("Displayed");
77+
return true;
78+
});
79+
80+
Assert.AreEqual("input", revealed.TagName);
81+
}
82+
}
83+
}

examples/java/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ repositories {
1010
}
1111

1212
dependencies {
13-
testImplementation 'org.seleniumhq.selenium:selenium-java:4.8.0'
14-
testImplementation 'org.seleniumhq.selenium:selenium-grid:4.8.0'
15-
testImplementation 'io.github.bonigarcia:webdrivermanager:5.3.2'
13+
testImplementation 'org.seleniumhq.selenium:selenium-java:4.9.1'
14+
testImplementation 'org.seleniumhq.selenium:selenium-grid:4.9.1'
1615
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
1716
}
1817

examples/java/pom.xml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,42 @@
1818
<project.reporting.outputEncoding>${project.encoding}</project.reporting.outputEncoding>
1919
</properties>
2020

21+
<repositories>
22+
<repository>
23+
<id>sonatype-nexus-snapshots</id>
24+
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
25+
<snapshots>
26+
<enabled>true</enabled>
27+
</snapshots>
28+
</repository>
29+
</repositories>
30+
2131
<dependencies>
2232
<dependency>
2333
<groupId>org.seleniumhq.selenium</groupId>
2434
<artifactId>selenium-java</artifactId>
25-
<version>4.8.0</version>
35+
<version>4.9.1</version>
2636
</dependency>
2737
<dependency>
2838
<groupId>org.seleniumhq.selenium</groupId>
2939
<artifactId>selenium-grid</artifactId>
30-
<version>4.8.0</version>
40+
<version>4.9.1</version>
3141
</dependency>
3242
<dependency>
3343
<groupId>org.slf4j</groupId>
3444
<artifactId>slf4j-api</artifactId>
35-
<version>1.7.36</version>
45+
<version>2.0.5</version>
3646
</dependency>
3747
<dependency>
3848
<groupId>ch.qos.logback</groupId>
3949
<artifactId>logback-classic</artifactId>
40-
<version>1.2.11</version>
50+
<version>1.4.6</version>
4151
</dependency>
4252

4353
<dependency>
4454
<groupId>org.junit.jupiter</groupId>
4555
<artifactId>junit-jupiter-engine</artifactId>
46-
<version>5.9.0</version>
47-
<scope>test</scope>
48-
</dependency>
49-
<dependency>
50-
<groupId>io.github.bonigarcia</groupId>
51-
<artifactId>webdrivermanager</artifactId>
52-
<version>5.3.2</version>
56+
<version>5.9.2</version>
5357
<scope>test</scope>
5458
</dependency>
5559
</dependencies>
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
11
package dev.selenium;
22

3+
import java.time.Duration;
34
import org.junit.jupiter.api.AfterEach;
5+
import org.junit.jupiter.api.BeforeAll;
6+
import org.openqa.selenium.By;
47
import org.openqa.selenium.WebDriver;
8+
import org.openqa.selenium.WebElement;
9+
import org.openqa.selenium.firefox.GeckoDriverService;
10+
import org.openqa.selenium.remote.service.DriverService;
11+
import org.openqa.selenium.support.ui.WebDriverWait;
512

613
public class BaseTest {
714
public WebDriver driver;
815

16+
@BeforeAll
17+
public static void defaultLogging() {
18+
System.setProperty(GeckoDriverService.GECKO_DRIVER_LOG_PROPERTY, DriverService.LOG_NULL);
19+
}
20+
21+
public WebElement getLocatedElement(WebDriver driver, By by) {
22+
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
23+
return wait.until(d -> driver.findElement(by));
24+
}
25+
926
@AfterEach
1027
public void quit() {
11-
driver.quit();
28+
if (driver != null) {
29+
driver.quit();
30+
}
1231
}
1332
}

examples/java/src/test/java/dev/selenium/bidirectional/BiDiTest.java

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)