Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add code example to .NET for adding extension
[deploy site]
- Loading branch information
1 parent
896798c
commit f5852ff
Showing
6 changed files
with
67 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,39 @@ | ||
using System; | ||
using System.IO; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using OpenQA.Selenium; | ||
using OpenQA.Selenium.Chrome; | ||
|
||
namespace SeleniumDocs.Browsers { | ||
[TestClass] | ||
public class ChromeTest { | ||
public class ChromeTest : BaseTest { | ||
[TestMethod] | ||
public void BasicOptions() { | ||
var options = new ChromeOptions(); | ||
var driver = new ChromeDriver(options); | ||
driver.Quit(); | ||
driver = new ChromeDriver(options); | ||
} | ||
|
||
[TestMethod] | ||
public void HeadlessOptions() { | ||
var options = new ChromeOptions(); | ||
options.AddArgument("--headless=new"); | ||
var driver = new ChromeDriver(options); | ||
driver.Quit(); | ||
driver = new ChromeDriver(options); | ||
} | ||
|
||
[TestMethod] | ||
public void InstallAddon() | ||
{ | ||
var options = new ChromeOptions(); | ||
var baseDir = AppDomain.CurrentDomain.BaseDirectory; | ||
var extensionFilePath = Path.Combine(baseDir, "../../../Extensions/webextensions-selenium-example.crx"); | ||
options.AddExtension(extensionFilePath); | ||
|
||
driver = new ChromeDriver(options); | ||
|
||
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); | ||
} | ||
} | ||
} |
Binary file added
BIN
+1.16 KB
examples/dotnet/SeleniumDocs/Extensions/webextensions-selenium-example.crx
Binary file not shown.
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