Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

144 Commits

Repository files navigation

Selenium.CefSharp.Driver_β


The status of this library is beta.

Features ...

It is a library for operating ChromiumWebBrowser with the interface of Selenium. Supports WinForms & WPF.

Getting Started

Install Selenium.CefSharp.Driver from NuGet

PM> Install-Package Selenium.CefSharp.Driver

https://www.nuget.org/packages/Selenium.CefSharp.Driver/

What problem can this solve?

Chrome driver is able to manipulate apps that are configured only with CefSharp, but it can't manipulate apps that used CefSharp for only part of it. This problem will be solved by using CefSharpDriver.

Another process manuplation.

This library is a layer on top of Friendly, so you must learn that first. But it is very easy to learn.
https://github.com/Codeer-Software/Friendly

Sample

https://github.com/Codeer-Software/Selenium.CefSharp.Driver/tree/master/Project/Sample
Sample App.
Sample App.

Code.

usingSystem.Diagnostics;usingSystem.IO;usingCodeer.Friendly;usingCodeer.Friendly.Dynamic;usingCodeer.Friendly.Windows;usingCodeer.Friendly.Windows.Grasp;usingMicrosoft.VisualStudio.TestTools.UnitTesting;usingOpenQA.Selenium;usingOpenQA.Selenium.Interactions;usingOpenQA.Selenium.Support.UI;usingRM.Friendly.WPFStandardControls;usingSelenium.CefSharp.Driver;namespaceSampleTest{[TestClass]publicclassUnitTest{WindowsAppFriend_app;CefSharpDriver_driver;[TestInitialize]publicvoidTestInitialize(){//start process.varprocess=Process.Start(ProcessPath);//attach by friendly._app=newWindowsAppFriend(process);//show next dialog.varmainWindow=_app.WaitForIdentifyFromTypeFullName("SampleApp.MainWindow");varbutton=newWPFButtonBase(mainWindow.Dynamic()._buttonNextDialog);button.EmulateClick(newAsync());//get next dialog.varnextDialog=_app.WaitForIdentifyFromTypeFullName("SampleApp.NextDialog");//create driver._driver=newCefSharpDriver(nextDialog.Dynamic()._browser);}[TestCleanup]publicvoidTestCleanup()=>Process.GetProcessById(_app.ProcessId).Kill();[TestMethod]publicvoidTestMethod(){//set url._driver.Url=HtmlPath;//find element by id.varbutton=_driver.FindElement(By.Id("testButtonClick"));//click.button.Click();//find element by name.vartextBox=_driver.FindElement(By.Name("nameInput"));//sendkeys.textBox.SendKeys("abc");//find element by tag.varselect=_driver.FindElement(By.TagName("select"));//selenium support.newSelectElement(select).SelectByText("Orange");//find element by xpath.varbuttonAlt=_driver.FindElement(By.XPath("//*[@id=\"form\"]/table/tbody/tr[7]/td/input[2]"));//actions.newActions(_driver).KeyDown(Keys.Alt).Click(buttonAlt).Build().Perform();//execute javascript.vardefaultValue=(string)_driver.ExecuteScript("return arguments[0].defaultValue;",textBox);}staticstringTestDir{get{vardir=typeof(UnitTest).Assembly.Location;for(inti=0;i<4;i++)dir=Path.GetDirectoryName(dir);returndir;}}staticstringProcessPath=>Path.Combine(TestDir,@"SampleApp\bin\x86\Debug\SampleApp.exe");staticstringHtmlPath=>Path.Combine(TestDir,"Controls.html");}}

Architecture

I'm not using WebDriver. The function is realized by the combination of the following processes.

Friendly

Call the API of another process.

JavaScript

Various processing is realized by JavaScript.

Key Mouse Emulate

A low level key mouse emulation. However, I am adjusting the timing.


Many Doxygen comments are copy from SeleniumHQ

Thank you!
https://github.com/SeleniumHQ/selenium

About

No description, website, or topics provided.

Resources

Stars

13 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages