Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ public class ChromeTest {
public void BasicOptions() {
var options = new ChromeOptions();
var driver = new ChromeDriver(options);
driver.Quit();
}

[TestMethod]
public void HeadlessOptions() {
var options = new ChromeOptions();
options.AddArgument("--headless=new");
var driver = new ChromeDriver(options);
driver.Quit();
}
}
Expand Down
8 changes: 8 additions & 0 deletions examples/dotnet/SeleniumDocs/Browsers/EdgeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ public void BasicOptions()
{
var options = new EdgeOptions();
var driver = new EdgeDriver(options);
driver.Quit();
}

[TestMethod]
public void HeadlessOptions()
{
var options = new EdgeOptions();
options.AddArgument("--headless=new");
var driver = new EdgeDriver(options);
driver.Quit();
}
}
Expand Down
44 changes: 26 additions & 18 deletions examples/dotnet/SeleniumDocs/Browsers/FirefoxTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,38 @@ public void InstallAddon()
[TestMethod]
public void UnInstallAddon()
{
driver = new FirefoxDriver();
driver = new FirefoxDriver();

string baseDir = AppDomain.CurrentDomain.BaseDirectory;
string extensionFilePath = Path.Combine(baseDir, "../../../Extensions/webextensions-selenium-example.xpi");
string extensionId = driver.InstallAddOnFromFile(Path.GetFullPath(extensionFilePath));
driver.UninstallAddOn(extensionId);
string baseDir = AppDomain.CurrentDomain.BaseDirectory;
string extensionFilePath = Path.Combine(baseDir, "../../../Extensions/webextensions-selenium-example.xpi");
string extensionId = driver.InstallAddOnFromFile(Path.GetFullPath(extensionFilePath));
driver.UninstallAddOn(extensionId);

driver.Url = "https://www.selenium.dev/selenium/web/blank.html";
Assert.AreEqual(driver.FindElements(By.Id("webextensions-selenium-example")).Count, 0);
driver.Url = "https://www.selenium.dev/selenium/web/blank.html";
Assert.AreEqual(driver.FindElements(By.Id("webextensions-selenium-example")).Count, 0);
}

[TestMethod]
public void InstallUnsignedAddon()
{
driver = new FirefoxDriver();
[TestMethod]
public void InstallUnsignedAddon()
{
driver = new FirefoxDriver();

string baseDir = AppDomain.CurrentDomain.BaseDirectory;
string extensionDirPath = Path.Combine(baseDir, "../../../Extensions/webextensions-selenium-example/");
driver.InstallAddOnFromDirectory(Path.GetFullPath(extensionDirPath), true);

string baseDir = AppDomain.CurrentDomain.BaseDirectory;
string extensionDirPath = Path.Combine(baseDir, "../../../Extensions/webextensions-selenium-example/");
driver.InstallAddOnFromDirectory(Path.GetFullPath(extensionDirPath), true);
driver.Url = "https://www.selenium.dev/selenium/web/blank.html";

driver.Url = "https://www.selenium.dev/selenium/web/blank.html";
IWebElement injected = driver.FindElement(By.Id("webextensions-selenium-example"));
Assert.AreEqual("Content injected by webextensions-selenium-example", injected.Text);
}

IWebElement injected = driver.FindElement(By.Id("webextensions-selenium-example"));
Assert.AreEqual("Content injected by webextensions-selenium-example", injected.Text);
}
[TestMethod]
public void HeadlessOptions()
{
var options = new FirefoxOptions();
options.AddArgument("--headless");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firefox documentation has only one dash

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

driver = new FirefoxDriver(options);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ public void basicOptions() {
ChromeOptions options = new ChromeOptions();
driver = new ChromeDriver(options);
}

@Test
public void headlessOptions() {
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless=new");
driver = new ChromeDriver(options);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ public void basicOptions() {
EdgeOptions options = new EdgeOptions();
driver = new EdgeDriver(options);
}

@Test
public void headlessOptions() {
EdgeOptions options = new EdgeOptions();
options.addArguments("--headless=new");
driver = new EdgeDriver(options);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,11 @@ public void installUnsignedAddonPath() {
WebElement injected = driver.findElement(By.id("webextensions-selenium-example"));
Assertions.assertEquals("Content injected by webextensions-selenium-example", injected.getText());
}

@Test
public void headlessOptions() {
FirefoxOptions options = new FirefoxOptions();
options.addArguments("-headless");
driver = new FirefoxDriver(options);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Links to everything can be found on our [downloads page][downloads].
* Chrome DevTools support is now: v107, v108, and v109 (Firefox still uses v85 for all versions)
* Large JS executions have the name as a comment to help understand what payload being sent to/from server/driver.
* Deprecation of headless convenience method. Read more about in the [headless blog post](/blog/2023/headless-is-going-away/).
* Ruby overhauls Options classes (again) (needs blog post)
* Ruby overhauls Options classes (again)
* Initial [BiDi] support in JavaScript, Ruby, and improvements in Java.
* We're continuing to remove [Legacy Protocol](/blog/2022/legacy-protocol-support/) classes in Java and Grid.
* Accommodate ability to specify sub-paths in Grid.
Expand Down