├── .gitignore ├── Img └── SampleApp.png ├── LICENSE ├── Project ├── .nuget │ ├── NuGet.Config │ ├── NuGet.exe │ ├── NuGet.targets │ └── Selenium.CefSharp.Driver.nuspec ├── CefSharpWPFTarget │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── CefSharpWPFTarget.csproj │ ├── CefSharpWPFTarget.sln │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ └── packages.config ├── CefSharpWinFormsTarget │ ├── App.config │ ├── CefSharpWinFormsTarget.csproj │ ├── CefSharpWinFormsTarget.sln │ ├── MainForm.Designer.cs │ ├── MainForm.cs │ ├── MainForm.resx │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ └── packages.config ├── Sample │ ├── Controls.html │ ├── SampleApp │ │ ├── App.config │ │ ├── App.xaml │ │ ├── App.xaml.cs │ │ ├── MainWindow.xaml │ │ ├── MainWindow.xaml.cs │ │ ├── NextDialog.xaml │ │ ├── NextDialog.xaml.cs │ │ ├── Properties │ │ │ ├── AssemblyInfo.cs │ │ │ ├── Resources.Designer.cs │ │ │ ├── Resources.resx │ │ │ ├── Settings.Designer.cs │ │ │ └── Settings.settings │ │ ├── SampleApp.csproj │ │ ├── SampleApp.sln │ │ └── packages.config │ └── SampleTest │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── SampleTest.csproj │ │ ├── SampleTest.sln │ │ ├── UnitTest.cs │ │ ├── app.config │ │ └── packages.config ├── Selenium.CefSharp.Driver.InTarget │ ├── AsyncResultBoundObject.cs │ ├── CefSharpChecker.cs │ ├── CefSharpWindowManagerFactory.cs │ ├── FrameFinder.cs │ ├── JSResultConverter.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── ReflectionAccessor.cs │ ├── Selenium.CefSharp.Driver.InTarget.csproj │ ├── Src │ │ └── CefSharpWindowManager.cs │ └── packages.config ├── Selenium.CefSharp.Driver.sln ├── Selenium.CefSharp.Driver │ ├── CefSharpDriver.cs │ ├── CefSharpWebElement.cs │ ├── Inside │ │ ├── ActionsAnalyzer.cs │ │ ├── Alert.cs │ │ ├── ApplicationCache.cs │ │ ├── CefSharpFrameDriver.cs │ │ ├── CefSharpWindowBrowser.cs │ │ ├── ChromiumWebBrowserDriver.cs │ │ ├── ClickSpeck.cs │ │ ├── Coordinates.cs │ │ ├── CotnrolAccessor.cs │ │ ├── ElementFinder.cs │ │ ├── ICefSharpBrowser.cs │ │ ├── JavaScriptAdaptor.cs │ │ ├── KeySpec.cs │ │ ├── NativeMethods.cs │ │ ├── Storag.cs │ │ └── WebStorage.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Selenium.CefSharp.Driver.csproj │ ├── app.config │ └── packages.config └── Test │ ├── FrameTest.cs │ ├── Html │ ├── Controls.html │ ├── Frame.html │ ├── FrameInner.html │ ├── Window.html │ └── favicon.ico │ ├── JavaScriptExecutorTest.cs │ ├── KeyMouseTest.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── SelectElementTest.cs │ ├── Test.csproj │ ├── Utility │ ├── AppRunner.cs │ ├── AssertCompatible.cs │ ├── ChainingAssertion.NUnit.cs │ ├── CompareTestBase.cs │ ├── ExpectedConditions.cs │ └── HtmlServer.cs │ ├── WebDriverTest.cs │ ├── WebElementTest.cs │ ├── WindowTest.cs │ ├── app.config │ └── packages.config └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015/2017 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # Visual Studio 2017 auto generated files 33 | Generated\ Files/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # Benchmark Results 49 | BenchmarkDotNet.Artifacts/ 50 | 51 | # .NET Core 52 | project.lock.json 53 | project.fragment.lock.json 54 | artifacts/ 55 | **/Properties/launchSettings.json 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_i.h 64 | *.ilk 65 | *.meta 66 | *.obj 67 | *.iobj 68 | *.pch 69 | *.pdb 70 | *.ipdb 71 | *.pgc 72 | *.pgd 73 | *.rsp 74 | *.sbr 75 | *.tlb 76 | *.tli 77 | *.tlh 78 | *.tmp 79 | *.tmp_proj 80 | *.log 81 | *.vspscc 82 | *.vssscc 83 | .builds 84 | *.pidb 85 | *.svclog 86 | *.scc 87 | 88 | # Chutzpah Test files 89 | _Chutzpah* 90 | 91 | # Visual C++ cache files 92 | ipch/ 93 | *.aps 94 | *.ncb 95 | *.opendb 96 | *.opensdf 97 | *.sdf 98 | *.cachefile 99 | *.VC.db 100 | *.VC.VC.opendb 101 | 102 | # Visual Studio profiler 103 | *.psess 104 | *.vsp 105 | *.vspx 106 | *.sap 107 | 108 | # Visual Studio Trace Files 109 | *.e2e 110 | 111 | # TFS 2012 Local Workspace 112 | $tf/ 113 | 114 | # Guidance Automation Toolkit 115 | *.gpState 116 | 117 | # ReSharper is a .NET coding add-in 118 | _ReSharper*/ 119 | *.[Rr]e[Ss]harper 120 | *.DotSettings.user 121 | 122 | # JustCode is a .NET coding add-in 123 | .JustCode 124 | 125 | # TeamCity is a build add-in 126 | _TeamCity* 127 | 128 | # DotCover is a Code Coverage Tool 129 | *.dotCover 130 | 131 | # AxoCover is a Code Coverage Tool 132 | .axoCover/* 133 | !.axoCover/settings.json 134 | 135 | # Visual Studio code coverage results 136 | *.coverage 137 | *.coveragexml 138 | 139 | # NCrunch 140 | _NCrunch_* 141 | .*crunch*.local.xml 142 | nCrunchTemp_* 143 | 144 | # MightyMoose 145 | *.mm.* 146 | AutoTest.Net/ 147 | 148 | # Web workbench (sass) 149 | .sass-cache/ 150 | 151 | # Installshield output folder 152 | [Ee]xpress/ 153 | 154 | # DocProject is a documentation generator add-in 155 | DocProject/buildhelp/ 156 | DocProject/Help/*.HxT 157 | DocProject/Help/*.HxC 158 | DocProject/Help/*.hhc 159 | DocProject/Help/*.hhk 160 | DocProject/Help/*.hhp 161 | DocProject/Help/Html2 162 | DocProject/Help/html 163 | 164 | # Click-Once directory 165 | publish/ 166 | 167 | # Publish Web Output 168 | *.[Pp]ublish.xml 169 | *.azurePubxml 170 | # Note: Comment the next line if you want to checkin your web deploy settings, 171 | # but database connection strings (with potential passwords) will be unencrypted 172 | *.pubxml 173 | *.publishproj 174 | 175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 176 | # checkin your Azure Web App publish settings, but sensitive information contained 177 | # in these scripts will be unencrypted 178 | PublishScripts/ 179 | 180 | # NuGet Packages 181 | *.nupkg 182 | # The packages folder can be ignored because of Package Restore 183 | **/[Pp]ackages/* 184 | # except build/, which is used as an MSBuild target. 185 | !**/[Pp]ackages/build/ 186 | # Uncomment if necessary however generally it will be regenerated when needed 187 | #!**/[Pp]ackages/repositories.config 188 | # NuGet v3's project.json files produces more ignorable files 189 | *.nuget.props 190 | *.nuget.targets 191 | 192 | # Microsoft Azure Build Output 193 | csx/ 194 | *.build.csdef 195 | 196 | # Microsoft Azure Emulator 197 | ecf/ 198 | rcf/ 199 | 200 | # Windows Store app package directories and files 201 | AppPackages/ 202 | BundleArtifacts/ 203 | Package.StoreAssociation.xml 204 | _pkginfo.txt 205 | *.appx 206 | 207 | # Visual Studio cache files 208 | # files ending in .cache can be ignored 209 | *.[Cc]ache 210 | # but keep track of directories ending in .cache 211 | !*.[Cc]ache/ 212 | 213 | # Others 214 | ClientBin/ 215 | ~$* 216 | *~ 217 | *.dbmdl 218 | *.dbproj.schemaview 219 | *.jfm 220 | *.pfx 221 | *.publishsettings 222 | orleans.codegen.cs 223 | 224 | # Including strong name files can present a security risk 225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 226 | #*.snk 227 | 228 | # Since there are multiple workflows, uncomment next line to ignore bower_components 229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 230 | #bower_components/ 231 | 232 | # RIA/Silverlight projects 233 | Generated_Code/ 234 | 235 | # Backup & report files from converting an old project file 236 | # to a newer Visual Studio version. Backup files are not needed, 237 | # because we have git ;-) 238 | _UpgradeReport_Files/ 239 | Backup*/ 240 | UpgradeLog*.XML 241 | UpgradeLog*.htm 242 | ServiceFabricBackup/ 243 | *.rptproj.bak 244 | 245 | # SQL Server files 246 | *.mdf 247 | *.ldf 248 | *.ndf 249 | 250 | # Business Intelligence projects 251 | *.rdl.data 252 | *.bim.layout 253 | *.bim_*.settings 254 | *.rptproj.rsuser 255 | 256 | # Microsoft Fakes 257 | FakesAssemblies/ 258 | 259 | # GhostDoc plugin setting file 260 | *.GhostDoc.xml 261 | 262 | # Node.js Tools for Visual Studio 263 | .ntvs_analysis.dat 264 | node_modules/ 265 | 266 | # Visual Studio 6 build log 267 | *.plg 268 | 269 | # Visual Studio 6 workspace options file 270 | *.opt 271 | 272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 273 | *.vbw 274 | 275 | # Visual Studio LightSwitch build output 276 | **/*.HTMLClient/GeneratedArtifacts 277 | **/*.DesktopClient/GeneratedArtifacts 278 | **/*.DesktopClient/ModelManifest.xml 279 | **/*.Server/GeneratedArtifacts 280 | **/*.Server/ModelManifest.xml 281 | _Pvt_Extensions 282 | 283 | # Paket dependency manager 284 | .paket/paket.exe 285 | paket-files/ 286 | 287 | # FAKE - F# Make 288 | .fake/ 289 | 290 | # JetBrains Rider 291 | .idea/ 292 | *.sln.iml 293 | 294 | # CodeRush 295 | .cr/ 296 | 297 | # Python Tools for Visual Studio (PTVS) 298 | __pycache__/ 299 | *.pyc 300 | 301 | # Cake - Uncomment if you are using it 302 | # tools/** 303 | # !tools/packages.config 304 | 305 | # Tabs Studio 306 | *.tss 307 | 308 | # Telerik's JustMock configuration file 309 | *.jmconfig 310 | 311 | # BizTalk build output 312 | *.btp.cs 313 | *.btm.cs 314 | *.odx.cs 315 | *.xsd.cs 316 | 317 | # OpenCover UI analysis results 318 | OpenCover/ 319 | 320 | # Azure Stream Analytics local run output 321 | ASALocalRun/ 322 | 323 | # MSBuild Binary and Structured Log 324 | *.binlog 325 | 326 | # NVidia Nsight GPU debugger configuration file 327 | *.nvuser 328 | 329 | # MFractors (Xamarin productivity tool) working folder 330 | .mfractor/ 331 | -------------------------------------------------------------------------------- /Img/SampleApp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codeer-Software/Selenium.CefSharp.Driver/c090dd7569175ce68d96e79db1a306895d85b3ce/Img/SampleApp.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Codeer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Project/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Project/.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codeer-Software/Selenium.CefSharp.Driver/c090dd7569175ce68d96e79db1a306895d85b3ce/Project/.nuget/NuGet.exe -------------------------------------------------------------------------------- /Project/.nuget/NuGet.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)\..\ 5 | 6 | 7 | false 8 | 9 | 10 | false 11 | 12 | 13 | true 14 | 15 | 16 | false 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) 31 | 32 | 33 | 34 | 35 | $(SolutionDir).nuget 36 | 37 | 38 | 39 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config 40 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config 41 | 42 | 43 | 44 | $(MSBuildProjectDirectory)\packages.config 45 | $(PackagesProjectConfig) 46 | 47 | 48 | 49 | 50 | $(NuGetToolsPath)\NuGet.exe 51 | @(PackageSource) 52 | 53 | "$(NuGetExePath)" 54 | mono --runtime=v4.0.30319 "$(NuGetExePath)" 55 | 56 | $(TargetDir.Trim('\\')) 57 | 58 | -RequireConsent 59 | -NonInteractive 60 | 61 | "$(SolutionDir) " 62 | "$(SolutionDir)" 63 | 64 | 65 | $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) 66 | $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols 67 | 68 | 69 | 70 | RestorePackages; 71 | $(BuildDependsOn); 72 | 73 | 74 | 75 | 76 | $(BuildDependsOn); 77 | BuildPackage; 78 | 79 | 80 | 81 | 82 | 83 | 84 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 99 | 100 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /Project/.nuget/Selenium.CefSharp.Driver.nuspec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codeer-Software/Selenium.CefSharp.Driver/c090dd7569175ce68d96e79db1a306895d85b3ce/Project/.nuget/Selenium.CefSharp.Driver.nuspec -------------------------------------------------------------------------------- /Project/CefSharpWPFTarget/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Project/CefSharpWPFTarget/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Project/CefSharpWPFTarget/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace CefSharpWPFTarget 10 | { 11 | /// 12 | /// App.xaml の相互作用ロジック 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Project/CefSharpWPFTarget/CefSharpWPFTarget.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Debug 9 | AnyCPU 10 | {BED1FFC3-888F-48F2-8D83-B8106D0989CC} 11 | WinExe 12 | CefSharpWPFTarget 13 | CefSharpWPFTarget 14 | v4.7.2 15 | 512 16 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 17 | 4 18 | true 19 | true 20 | 21 | 22 | true 23 | 24 | 25 | 26 | x86 27 | true 28 | full 29 | false 30 | bin\Debug\ 31 | DEBUG;TRACE 32 | prompt 33 | 4 34 | 35 | 36 | AnyCPU 37 | pdbonly 38 | true 39 | bin\Release\ 40 | TRACE 41 | prompt 42 | 4 43 | 44 | 45 | true 46 | bin\x86\Debug\ 47 | DEBUG;TRACE 48 | full 49 | x86 50 | 7.3 51 | prompt 52 | MinimumRecommendedRules.ruleset 53 | true 54 | 55 | 56 | bin\x86\Release\ 57 | TRACE 58 | true 59 | pdbonly 60 | x86 61 | 7.3 62 | prompt 63 | MinimumRecommendedRules.ruleset 64 | true 65 | 66 | 67 | 68 | packages\CefSharp.Common.87.1.132\lib\net452\CefSharp.dll 69 | 70 | 71 | packages\CefSharp.Common.87.1.132\lib\net452\CefSharp.Core.dll 72 | 73 | 74 | packages\CefSharp.Wpf.87.1.132\lib\net452\CefSharp.Wpf.dll 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 4.0 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | MSBuild:Compile 94 | Designer 95 | 96 | 97 | True 98 | True 99 | Resources.resx 100 | 101 | 102 | MSBuild:Compile 103 | Designer 104 | 105 | 106 | App.xaml 107 | Code 108 | 109 | 110 | MainWindow.xaml 111 | Code 112 | 113 | 114 | 115 | 116 | Code 117 | 118 | 119 | True 120 | Settings.settings 121 | True 122 | 123 | 124 | ResXFileCodeGenerator 125 | Resources.Designer.cs 126 | 127 | 128 | 129 | SettingsSingleFileGenerator 130 | Settings.Designer.cs 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | このプロジェクトは、このコンピューター上にない NuGet パッケージを参照しています。それらのパッケージをダウンロードするには、[NuGet パッケージの復元] を使用します。詳細については、http://go.microsoft.com/fwlink/?LinkID=322105 を参照してください。見つからないファイルは {0} です。 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /Project/CefSharpWPFTarget/CefSharpWPFTarget.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29409.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CefSharpWPFTarget", "CefSharpWPFTarget.csproj", "{BED1FFC3-888F-48F2-8D83-B8106D0989CC}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x86 = Debug|x86 12 | Release|Any CPU = Release|Any CPU 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {BED1FFC3-888F-48F2-8D83-B8106D0989CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {BED1FFC3-888F-48F2-8D83-B8106D0989CC}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {BED1FFC3-888F-48F2-8D83-B8106D0989CC}.Debug|x86.ActiveCfg = Debug|x86 19 | {BED1FFC3-888F-48F2-8D83-B8106D0989CC}.Debug|x86.Build.0 = Debug|x86 20 | {BED1FFC3-888F-48F2-8D83-B8106D0989CC}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {BED1FFC3-888F-48F2-8D83-B8106D0989CC}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {BED1FFC3-888F-48F2-8D83-B8106D0989CC}.Release|x86.ActiveCfg = Release|x86 23 | {BED1FFC3-888F-48F2-8D83-B8106D0989CC}.Release|x86.Build.0 = Release|x86 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {02246617-4BEE-4391-882C-E461C29A36EF} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /Project/CefSharpWPFTarget/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Project/CefSharpWPFTarget/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace CefSharpWPFTarget 4 | { 5 | public partial class MainWindow : Window 6 | { 7 | public bool IsLoadEnded { get; set; } 8 | 9 | public MainWindow() 10 | { 11 | InitializeComponent(); 12 | _browser.FrameLoadEnd += (_, __) => IsLoadEnded = true; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project/CefSharpWPFTarget/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 8 | // アセンブリに関連付けられている情報を変更するには、 9 | // これらの属性値を変更してください。 10 | [assembly: AssemblyTitle("CefSharpWPFSample")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("CefSharpWPFSample")] 15 | [assembly: AssemblyCopyright("Copyright © 2019")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから 20 | // 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 21 | // その型の ComVisible 属性を true に設定してください。 22 | [assembly: ComVisible(false)] 23 | 24 | //ローカライズ可能なアプリケーションのビルドを開始するには、 25 | //.csproj ファイルの CultureYouAreCodingWith を 26 | // 内部で設定します。たとえば、 27 | //ソース ファイルで英語を使用している場合、 を en-US に設定します。次に、 28 | //下の NeutralResourceLanguage 属性のコメントを解除します。下の行の "en-US" を 29 | //プロジェクト ファイルの UICulture 設定と一致するよう更新します。 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //テーマ固有のリソース ディクショナリが置かれている場所 36 | //(リソースがページ、 37 | // またはアプリケーション リソース ディクショナリに見つからない場合に使用されます) 38 | ResourceDictionaryLocation.SourceAssembly //汎用リソース ディクショナリが置かれている場所 39 | //(リソースがページ、 40 | //アプリケーション、またはいずれのテーマ固有のリソース ディクショナリにも見つからない場合に使用されます) 41 | )] 42 | 43 | 44 | // アセンブリのバージョン情報は次の 4 つの値で構成されています: 45 | // 46 | // メジャー バージョン 47 | // マイナー バージョン 48 | // ビルド番号 49 | // リビジョン 50 | // 51 | // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます 52 | // 既定値にすることができます: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /Project/CefSharpWPFTarget/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.42000 5 | // 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 7 | // コードが再生成されるときに損失したりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CefSharpWPFTarget.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 17 | /// 18 | // このクラスは StronglyTypedResourceBuilder クラスが ResGen 19 | // または Visual Studio のようなツールを使用して自動生成されました。 20 | // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に 21 | // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CefSharpWPFTarget.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします 51 | /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Project/CefSharpWPFTarget/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Project/CefSharpWPFTarget/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.42000 5 | // 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 7 | // コードが再生成されるときに損失したりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CefSharpWPFTarget.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Project/CefSharpWPFTarget/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Project/CefSharpWPFTarget/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Project/CefSharpWinFormsTarget/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Project/CefSharpWinFormsTarget/CefSharpWinFormsTarget.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Debug 10 | AnyCPU 11 | {67DF412E-2D18-4489-99E7-0B68C3510394} 12 | WinExe 13 | CefSharpWinFormsTarget 14 | CefSharpWinFormsTarget 15 | v4.7.2 16 | 512 17 | true 18 | true 19 | 20 | 21 | true 22 | 23 | 24 | AnyCPU 25 | true 26 | full 27 | false 28 | bin\Debug\ 29 | DEBUG;TRACE 30 | prompt 31 | 4 32 | 33 | 34 | AnyCPU 35 | pdbonly 36 | true 37 | bin\Release\ 38 | TRACE 39 | prompt 40 | 4 41 | 42 | 43 | true 44 | bin\x86\Debug\ 45 | DEBUG;TRACE 46 | full 47 | x86 48 | 7.3 49 | prompt 50 | MinimumRecommendedRules.ruleset 51 | true 52 | 53 | 54 | bin\x86\Release\ 55 | TRACE 56 | true 57 | pdbonly 58 | x86 59 | 7.3 60 | prompt 61 | MinimumRecommendedRules.ruleset 62 | true 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | Form 80 | 81 | 82 | MainForm.cs 83 | 84 | 85 | 86 | 87 | MainForm.cs 88 | 89 | 90 | ResXFileCodeGenerator 91 | Resources.Designer.cs 92 | Designer 93 | 94 | 95 | True 96 | Resources.resx 97 | True 98 | 99 | 100 | 101 | SettingsSingleFileGenerator 102 | Settings.Designer.cs 103 | 104 | 105 | True 106 | Settings.settings 107 | True 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | このプロジェクトは、このコンピューター上にない NuGet パッケージを参照しています。それらのパッケージをダウンロードするには、[NuGet パッケージの復元] を使用します。詳細については、http://go.microsoft.com/fwlink/?LinkID=322105 を参照してください。見つからないファイルは {0} です。 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /Project/CefSharpWinFormsTarget/CefSharpWinFormsTarget.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30114.105 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CefSharpWinFormsTarget", "CefSharpWinFormsTarget.csproj", "{67DF412E-2D18-4489-99E7-0B68C3510394}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x86 = Debug|x86 12 | Release|Any CPU = Release|Any CPU 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {67DF412E-2D18-4489-99E7-0B68C3510394}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {67DF412E-2D18-4489-99E7-0B68C3510394}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {67DF412E-2D18-4489-99E7-0B68C3510394}.Debug|x86.ActiveCfg = Debug|x86 19 | {67DF412E-2D18-4489-99E7-0B68C3510394}.Debug|x86.Build.0 = Debug|x86 20 | {67DF412E-2D18-4489-99E7-0B68C3510394}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {67DF412E-2D18-4489-99E7-0B68C3510394}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {67DF412E-2D18-4489-99E7-0B68C3510394}.Release|x86.ActiveCfg = Release|x86 23 | {67DF412E-2D18-4489-99E7-0B68C3510394}.Release|x86.Build.0 = Release|x86 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {20D85644-C358-4062-BE78-F3193FC652DC} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /Project/CefSharpWinFormsTarget/MainForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace CefSharpWinFormsTarget 2 | { 3 | partial class MainForm 4 | { 5 | /// 6 | /// 必要なデザイナー変数です。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 使用中のリソースをすべてクリーンアップします。 12 | /// 13 | /// マネージド リソースを破棄する場合は true を指定し、その他の場合は false を指定します。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows フォーム デザイナーで生成されたコード 24 | 25 | /// 26 | /// デザイナー サポートに必要なメソッドです。このメソッドの内容を 27 | /// コード エディターで変更しないでください。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // MainForm 34 | // 35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 | this.ClientSize = new System.Drawing.Size(800, 450); 38 | this.Name = "MainForm"; 39 | this.Text = "MainWindow"; 40 | this.ResumeLayout(false); 41 | 42 | } 43 | 44 | #endregion 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /Project/CefSharpWinFormsTarget/MainForm.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | 3 | namespace CefSharpWinFormsTarget 4 | { 5 | public partial class MainForm : Form 6 | { 7 | CefSharp.WinForms.ChromiumWebBrowser _browser = new CefSharp.WinForms.ChromiumWebBrowser("https://github.com/Codeer-Software/Selenium.CefSharp.Driver"); 8 | 9 | public bool IsLoadEnded { get; set; } 10 | 11 | public MainForm() 12 | { 13 | InitializeComponent(); 14 | _browser.Dock = DockStyle.Fill; 15 | Controls.Add(_browser); 16 | _browser.FrameLoadEnd += (_, __) => IsLoadEnded = true; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Project/CefSharpWinFormsTarget/MainForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Project/CefSharpWinFormsTarget/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace CefSharpWinFormsTarget 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// アプリケーションのメイン エントリ ポイントです。 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new MainForm()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Project/CefSharpWinFormsTarget/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 6 | // 制御されます。アセンブリに関連付けられている情報を変更するには、 7 | // これらの属性値を変更します。 8 | [assembly: AssemblyTitle("CefSharpWinFormsSample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CefSharpWinFormsSample")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから 18 | // 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 19 | // その型の ComVisible 属性を true に設定してください。 20 | [assembly: ComVisible(false)] 21 | 22 | // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります 23 | [assembly: Guid("67df412e-2d18-4489-99e7-0b68c3510394")] 24 | 25 | // アセンブリのバージョン情報は、以下の 4 つの値で構成されています: 26 | // 27 | // メジャー バージョン 28 | // マイナー バージョン 29 | // ビルド番号 30 | // リビジョン 31 | // 32 | // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます 33 | // 既定値にすることができます: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Project/CefSharpWinFormsTarget/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.42000 5 | // 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 7 | // コードが再生成されるときに損失したりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CefSharpWinFormsTarget.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 17 | /// 18 | // このクラスは StronglyTypedResourceBuilder クラスが ResGen 19 | // または Visual Studio のようなツールを使用して自動生成されました。 20 | // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に 21 | // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CefSharpWinFormsTarget.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします 51 | /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Project/CefSharpWinFormsTarget/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Project/CefSharpWinFormsTarget/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.42000 5 | // 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 7 | // コードが再生成されるときに損失したりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CefSharpWinFormsTarget.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.6.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Project/CefSharpWinFormsTarget/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Project/CefSharpWinFormsTarget/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Project/Sample/Controls.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Controls for Test 5 | 19 | 20 | 21 | 22 | 23 | Title Controls 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | Name: 32 | 33 | 34 | 35 | Date: 36 | 37 | 38 | 39 | Gender: 40 | 41 | Man 42 | Woman 43 | 44 | 45 | 46 | Personal belongings: 47 | 48 | Cell phone 49 | Casr 50 | Cottage 51 | 52 | 53 | 54 | Favorite fruit: 55 | 56 | 57 | Apple 58 | Orange 59 | Banana 60 | Pinapple 61 | 62 | 63 | 64 | 65 | 66 | Please describe the free opinion 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /Project/Sample/SampleApp/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Project/Sample/SampleApp/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Project/Sample/SampleApp/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace SampleApp 10 | { 11 | /// 12 | /// App.xaml の相互作用ロジック 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Project/Sample/SampleApp/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Project/Sample/SampleApp/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace SampleApp 4 | { 5 | public partial class MainWindow : Window 6 | { 7 | public MainWindow() 8 | => InitializeComponent(); 9 | 10 | void _buttonNextDialog_Click(object sender, RoutedEventArgs e) 11 | => new NextDialog().ShowDialog(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Project/Sample/SampleApp/NextDialog.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Project/Sample/SampleApp/NextDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | 15 | namespace SampleApp 16 | { 17 | /// 18 | /// NextDialog.xaml の相互作用ロジック 19 | /// 20 | public partial class NextDialog : Window 21 | { 22 | public NextDialog() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Project/Sample/SampleApp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 8 | // アセンブリに関連付けられている情報を変更するには、 9 | // これらの属性値を変更してください。 10 | [assembly: AssemblyTitle("SampleApp")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("SampleApp")] 15 | [assembly: AssemblyCopyright("Copyright © 2020")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから 20 | // 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 21 | // その型の ComVisible 属性を true に設定してください。 22 | [assembly: ComVisible(false)] 23 | 24 | //ローカライズ可能なアプリケーションのビルドを開始するには、 25 | //.csproj ファイルの CultureYouAreCodingWith を 26 | // 内部で設定します。たとえば、 27 | //ソース ファイルで英語を使用している場合、 を en-US に設定します。次に、 28 | //下の NeutralResourceLanguage 属性のコメントを解除します。下の行の "en-US" を 29 | //プロジェクト ファイルの UICulture 設定と一致するよう更新します。 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //テーマ固有のリソース ディクショナリが置かれている場所 36 | //(リソースがページ、 37 | // またはアプリケーション リソース ディクショナリに見つからない場合に使用されます) 38 | ResourceDictionaryLocation.SourceAssembly //汎用リソース ディクショナリが置かれている場所 39 | //(リソースがページ、 40 | //アプリケーション、またはいずれのテーマ固有のリソース ディクショナリにも見つからない場合に使用されます) 41 | )] 42 | 43 | 44 | // アセンブリのバージョン情報は次の 4 つの値で構成されています: 45 | // 46 | // メジャー バージョン 47 | // マイナー バージョン 48 | // ビルド番号 49 | // リビジョン 50 | // 51 | // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます 52 | // 既定値にすることができます: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /Project/Sample/SampleApp/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.42000 5 | // 6 | // このファイルへの変更は、正しくない動作の原因になったり、 7 | // コードが再生成されるときに失われたりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SampleApp.Properties 12 | { 13 | 14 | 15 | /// 16 | /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 17 | /// 18 | // このクラスは StronglyTypedResourceBuilder クラスによって ResGen 19 | // または Visual Studio のようなツールを使用して自動生成されました。 20 | // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に 21 | // ResGen を実行し直すか、または VS プロジェクトをリビルドします。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// このクラスで使用されるキャッシュされた ResourceManager インスタンスを返します。 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SampleApp.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします 56 | /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Project/Sample/SampleApp/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Project/Sample/SampleApp/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SampleApp.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Project/Sample/SampleApp/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Project/Sample/SampleApp/SampleApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Debug 9 | AnyCPU 10 | {FEFDA9AB-FDE7-4E94-B42F-C4DB64AB7E58} 11 | WinExe 12 | SampleApp 13 | SampleApp 14 | v4.7.2 15 | 512 16 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 17 | 4 18 | true 19 | true 20 | 21 | 22 | 23 | 24 | AnyCPU 25 | true 26 | full 27 | false 28 | bin\Debug\ 29 | DEBUG;TRACE 30 | prompt 31 | 4 32 | 33 | 34 | AnyCPU 35 | pdbonly 36 | true 37 | bin\Release\ 38 | TRACE 39 | prompt 40 | 4 41 | 42 | 43 | true 44 | bin\x86\Debug\ 45 | DEBUG;TRACE 46 | full 47 | x86 48 | 7.3 49 | prompt 50 | MinimumRecommendedRules.ruleset 51 | true 52 | 53 | 54 | bin\x86\Release\ 55 | TRACE 56 | true 57 | pdbonly 58 | x86 59 | 7.3 60 | prompt 61 | MinimumRecommendedRules.ruleset 62 | true 63 | 64 | 65 | 66 | packages\CefSharp.Common.94.4.110\lib\net452\CefSharp.dll 67 | 68 | 69 | packages\CefSharp.Common.94.4.110\lib\net452\CefSharp.Core.dll 70 | 71 | 72 | packages\CefSharp.Wpf.94.4.110\lib\net462\CefSharp.Wpf.dll 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 4.0 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | MSBuild:Compile 92 | Designer 93 | 94 | 95 | MSBuild:Compile 96 | Designer 97 | 98 | 99 | App.xaml 100 | Code 101 | 102 | 103 | MainWindow.xaml 104 | Code 105 | 106 | 107 | Designer 108 | MSBuild:Compile 109 | 110 | 111 | 112 | 113 | NextDialog.xaml 114 | 115 | 116 | Code 117 | 118 | 119 | True 120 | True 121 | Resources.resx 122 | 123 | 124 | True 125 | Settings.settings 126 | True 127 | 128 | 129 | ResXFileCodeGenerator 130 | Resources.Designer.cs 131 | 132 | 133 | 134 | SettingsSingleFileGenerator 135 | Settings.Designer.cs 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | このプロジェクトは、このコンピューター上にない NuGet パッケージを参照しています。それらのパッケージをダウンロードするには、[NuGet パッケージの復元] を使用します。詳細については、http://go.microsoft.com/fwlink/?LinkID=322105 を参照してください。見つからないファイルは {0} です。 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /Project/Sample/SampleApp/SampleApp.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30114.105 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleApp", "SampleApp.csproj", "{FEFDA9AB-FDE7-4E94-B42F-C4DB64AB7E58}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x86 = Debug|x86 12 | Release|Any CPU = Release|Any CPU 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {FEFDA9AB-FDE7-4E94-B42F-C4DB64AB7E58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {FEFDA9AB-FDE7-4E94-B42F-C4DB64AB7E58}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {FEFDA9AB-FDE7-4E94-B42F-C4DB64AB7E58}.Debug|x86.ActiveCfg = Debug|x86 19 | {FEFDA9AB-FDE7-4E94-B42F-C4DB64AB7E58}.Debug|x86.Build.0 = Debug|x86 20 | {FEFDA9AB-FDE7-4E94-B42F-C4DB64AB7E58}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {FEFDA9AB-FDE7-4E94-B42F-C4DB64AB7E58}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {FEFDA9AB-FDE7-4E94-B42F-C4DB64AB7E58}.Release|x86.ActiveCfg = Release|x86 23 | {FEFDA9AB-FDE7-4E94-B42F-C4DB64AB7E58}.Release|x86.Build.0 = Release|x86 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {23781DA0-4258-4883-9E21-8428E0A3603F} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /Project/Sample/SampleApp/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Project/Sample/SampleTest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("SampleTest")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("SampleTest")] 10 | [assembly: AssemblyCopyright("Copyright © 2020")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | 14 | [assembly: ComVisible(false)] 15 | 16 | [assembly: Guid("0170c011-3c23-4f93-bbe5-a4073f6350b5")] 17 | 18 | // [assembly: AssemblyVersion("1.0.*")] 19 | [assembly: AssemblyVersion("1.0.0.0")] 20 | [assembly: AssemblyFileVersion("1.0.0.0")] 21 | -------------------------------------------------------------------------------- /Project/Sample/SampleTest/SampleTest.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30114.105 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleTest", "SampleTest.csproj", "{0170C011-3C23-4F93-BBE5-A4073F6350B5}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "html", "html", "{12E030AB-3436-4785-979D-F931BB547E64}" 9 | ProjectSection(SolutionItems) = preProject 10 | ..\Controls.html = ..\Controls.html 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {0170C011-3C23-4F93-BBE5-A4073F6350B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {0170C011-3C23-4F93-BBE5-A4073F6350B5}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {0170C011-3C23-4F93-BBE5-A4073F6350B5}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {0170C011-3C23-4F93-BBE5-A4073F6350B5}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | GlobalSection(ExtensibilityGlobals) = postSolution 28 | SolutionGuid = {7C07C6F6-9264-4A7E-AFF1-955EB77A9122} 29 | EndGlobalSection 30 | EndGlobal 31 | -------------------------------------------------------------------------------- /Project/Sample/SampleTest/UnitTest.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.IO; 3 | using Codeer.Friendly; 4 | using Codeer.Friendly.Dynamic; 5 | using Codeer.Friendly.Windows; 6 | using Codeer.Friendly.Windows.Grasp; 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using OpenQA.Selenium; 9 | using OpenQA.Selenium.Interactions; 10 | using OpenQA.Selenium.Support.UI; 11 | using RM.Friendly.WPFStandardControls; 12 | using Selenium.CefSharp.Driver; 13 | 14 | namespace SampleTest 15 | { 16 | [TestClass] 17 | public class UnitTest 18 | { 19 | WindowsAppFriend _app; 20 | CefSharpDriver _driver; 21 | 22 | [TestInitialize] 23 | public void TestInitialize() 24 | { 25 | //start process. 26 | var process = Process.Start(ProcessPath); 27 | 28 | //attach by friendly. 29 | _app = new WindowsAppFriend(process); 30 | 31 | //show next dialog. 32 | var mainWindow = _app.WaitForIdentifyFromTypeFullName("SampleApp.MainWindow"); 33 | var button = new WPFButtonBase(mainWindow.Dynamic()._buttonNextDialog); 34 | button.EmulateClick(new Async()); 35 | 36 | //get next dialog. 37 | var nextDialog = _app.WaitForIdentifyFromTypeFullName("SampleApp.NextDialog"); 38 | 39 | //create driver. 40 | _driver = new CefSharpDriver(nextDialog.Dynamic()._browser); 41 | } 42 | 43 | [TestCleanup] 44 | public void TestCleanup() 45 | => Process.GetProcessById(_app.ProcessId).Kill(); 46 | 47 | [TestMethod] 48 | public void TestMethod() 49 | { 50 | //set url. 51 | _driver.Url = HtmlPath; 52 | 53 | //find element by id. 54 | var button = _driver.FindElement(By.Id("testButtonClick")); 55 | 56 | //click. 57 | button.Click(); 58 | 59 | //find element by name. 60 | var textBox = _driver.FindElement(By.Name("nameInput")); 61 | 62 | //sendkeys. 63 | textBox.SendKeys("abc"); 64 | 65 | //find element by tag. 66 | var select = _driver.FindElement(By.TagName("select")); 67 | 68 | //selenium support. 69 | new SelectElement(select).SelectByText("Orange"); 70 | 71 | //find element by xpath. 72 | var buttonAlt = _driver.FindElement(By.XPath("//*[@id=\"form\"]/table/tbody/tr[7]/td/input[2]")); 73 | 74 | //actions. 75 | new Actions(_driver).KeyDown(Keys.Alt).Click(buttonAlt).Build().Perform(); 76 | 77 | //execute javascript. 78 | var defaultValue = (string)_driver.ExecuteScript("return arguments[0].defaultValue;", textBox); 79 | } 80 | 81 | static string TestDir 82 | { 83 | get 84 | { 85 | var dir = typeof(UnitTest).Assembly.Location; 86 | for (int i = 0; i < 4; i++) dir = Path.GetDirectoryName(dir); 87 | return dir; 88 | } 89 | } 90 | 91 | static string ProcessPath => Path.Combine(TestDir, @"SampleApp\bin\x86\Debug\SampleApp.exe"); 92 | 93 | static string HtmlPath => Path.Combine(TestDir, "Controls.html"); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /Project/Sample/SampleTest/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Project/Sample/SampleTest/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver.InTarget/AsyncResultBoundObject.cs: -------------------------------------------------------------------------------- 1 | namespace Selenium.CefSharp.Driver.InTarget 2 | { 3 | public class AsyncResultBoundObject 4 | { 5 | public void Complete(object value) 6 | { 7 | this.Value = JSResultConverter.ConvertToSelializable(value); 8 | this.IsCompleted = true; 9 | } 10 | 11 | public bool IsCompleted { get; private set; } = false; 12 | 13 | public object Value { get; private set; } = null; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver.InTarget/CefSharpChecker.cs: -------------------------------------------------------------------------------- 1 | namespace Selenium.CefSharp.Driver.InTarget 2 | { 3 | public class CefSharpChecker 4 | { 5 | public static bool IsEvaluateScriptAsyncArgs4() 6 | { 7 | var iFrameType = ReflectionAccessor.GetType("CefSharp.IFrame"); 8 | return iFrameType.GetMethod("EvaluateScriptAsync").GetParameters().Length == 4; 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver.InTarget/CefSharpWindowManagerFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.CodeDom.Compiler; 3 | using System.Collections.Generic; 4 | using Microsoft.CSharp; 5 | using Selenium.CefSharp.Driver.InTarget.Properties; 6 | 7 | namespace Selenium.CefSharp.Driver.InTarget 8 | { 9 | public class CefSharpWindowManagerFactory 10 | { 11 | const string CefSharpWindowManagerTypeFullName = "Selenium.CefSharp.Driver.CefSharpWindowManager"; 12 | 13 | public static object InstallCefSharpWindowManager(dynamic browser) 14 | { 15 | if (browser.LifeSpanHandler != null) 16 | { 17 | if (browser.LifeSpanHandler.GetType().FullName == CefSharpWindowManagerTypeFullName) 18 | { 19 | return browser.LifeSpanHandler; 20 | } 21 | return null; 22 | } 23 | browser.LifeSpanHandler = Create(); 24 | return browser.LifeSpanHandler; 25 | } 26 | 27 | static dynamic Create() => Activator.CreateInstance(CreateType()); 28 | 29 | static Type CreateType() 30 | { 31 | Type t = ReflectionAccessor.GetType(CefSharpWindowManagerTypeFullName); 32 | if (t != null) 33 | { 34 | return t; 35 | } 36 | 37 | var reference = new List(); 38 | reference.Add("System.dll"); 39 | foreach (var asm in AppDomain.CurrentDomain.GetAssemblies()) 40 | { 41 | switch (asm.GetName().Name) 42 | { 43 | case "CefSharp": 44 | case "CefSharp.Core": 45 | case "CefSharp.Wpf": 46 | reference.Add(asm.Location); 47 | break; 48 | } 49 | } 50 | Compile(reference.ToArray(), Resources.CefSharpWindowManager); 51 | return ReflectionAccessor.GetType(CefSharpWindowManagerTypeFullName); 52 | } 53 | 54 | static CompilerResults Compile(string[] reference, string code) 55 | { 56 | if (reference == null) 57 | { 58 | throw new ArgumentNullException("reference"); 59 | } 60 | CSharpCodeProvider codeProvider = new CSharpCodeProvider(); 61 | CompilerParameters param = new CompilerParameters(); 62 | param.GenerateInMemory = true; 63 | 64 | for (int i = 0; i < reference.Length; i++) 65 | { 66 | param.ReferencedAssemblies.Add(reference[i]); 67 | } 68 | param.IncludeDebugInformation = true; 69 | 70 | return codeProvider.CompileAssemblyFromSource(param, code); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver.InTarget/FrameFinder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace Selenium.CefSharp.Driver.InTarget 6 | { 7 | public class FrameFinder 8 | { 9 | public static object FindFrame(object browser, object parentFrame, List frameNames, int childIndex) 10 | { 11 | if (childIndex < 0) return null; 12 | var children = GetChildren(browser, parentFrame, frameNames); 13 | if (children.Length <= childIndex) return null; 14 | return children[childIndex]; 15 | } 16 | 17 | public static object GetMainFrame(object browser) 18 | { 19 | var browserAcs = new ReflectionAccessor(browser); 20 | 21 | foreach (var e in browserAcs.InvokeMethod("GetFrameIdentifiers")) 22 | { 23 | var frame = browserAcs.InvokeMethodByType("GetFrame", e); 24 | var frameAcs = new ReflectionAccessor(frame); 25 | if (frameAcs.GetProperty("IsMain")) return frame; 26 | } 27 | return null; 28 | } 29 | static object[] GetChildren(object browser, object parentFrame, List frameNames) 30 | { 31 | var browserAcs = new ReflectionAccessor(browser); 32 | 33 | var allFrames = new List(); 34 | foreach (var e in browserAcs.InvokeMethod("GetFrameIdentifiers")) 35 | { 36 | allFrames.Add(browserAcs.InvokeMethodByType("GetFrame", e)); 37 | } 38 | 39 | var parentFrameIdentifier = new ReflectionAccessor(parentFrame).GetProperty("Identifier"); 40 | var children = new List(); 41 | foreach (var frame in allFrames) 42 | { 43 | var frameAcs = new ReflectionAccessor(frame); 44 | var parent = frameAcs.GetProperty("Parent"); 45 | if (parent == null) continue; 46 | 47 | var parentAcs = new ReflectionAccessor(parent); 48 | if (parentAcs.GetProperty("Identifier") == parentFrameIdentifier) 49 | { 50 | children.Add(frameAcs); 51 | } 52 | } 53 | 54 | //sort 55 | //For names with names on dom, use the order of appearance. 56 | children = children.OrderBy(e => e.GetProperty("Name")).ToList(); 57 | if (children.Count < frameNames.Count) return children.ToArray(); 58 | 59 | var sortedChildren = new object[children.Count]; 60 | 61 | for (int i = 0; i < children.Count; i++) 62 | { 63 | var e = children[i]; 64 | var index = frameNames.IndexOf(e.GetProperty("Name")); 65 | if (index == -1) continue; 66 | sortedChildren[index] = e.Object; 67 | children[i] = null; 68 | } 69 | 70 | int j = 0; 71 | for (int i = 0; i < children.Count; i++) 72 | { 73 | var e = children[i]; 74 | if (e == null) continue; 75 | 76 | for (; j < sortedChildren.Length; j++) 77 | { 78 | if (sortedChildren[j] == null) 79 | { 80 | sortedChildren[j] = e.Object; 81 | j++; 82 | break; 83 | } 84 | } 85 | } 86 | return sortedChildren; 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver.InTarget/JSResultConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Dynamic; 3 | using System.Linq; 4 | 5 | namespace Selenium.CefSharp.Driver.InTarget 6 | { 7 | public class JSResultConverter 8 | { 9 | public static object ConvertToSelializable(object src) 10 | { 11 | if (src is ExpandoObject expandObjet) 12 | { 13 | var dst = new Dictionary(); 14 | foreach (var e in expandObjet) 15 | { 16 | dst[e.Key] = ConvertToSelializable(e.Value); 17 | } 18 | return dst; 19 | } 20 | else if (src is List list) 21 | { 22 | return list.Select(i => ConvertToSelializable(i)).ToList(); 23 | } 24 | 25 | //TODO Add any other necessary conversions. 26 | 27 | return src; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver.InTarget/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 6 | // 制御されます。アセンブリに関連付けられている情報を変更するには、 7 | // これらの属性値を変更してください。 8 | [assembly: AssemblyTitle("Selenium.CefSharp.Driver.InTarget")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Selenium.CefSharp.Driver.InTarget")] 13 | [assembly: AssemblyCopyright("Copyright © 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから 18 | // 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 19 | // その型の ComVisible 属性を true に設定してください。 20 | [assembly: ComVisible(false)] 21 | 22 | // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります 23 | [assembly: Guid("3dd479ef-1a1c-49ff-83f7-76ffaa14db1b")] 24 | 25 | // アセンブリのバージョン情報は、以下の 4 つの値で構成されています: 26 | // 27 | // メジャー バージョン 28 | // マイナー バージョン 29 | // ビルド番号 30 | // リビジョン 31 | // 32 | // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます 33 | // 既定値にすることができます: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("0.14.2.0")] 36 | [assembly: AssemblyFileVersion("0.14.2.0")] 37 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver.InTarget/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.42000 5 | // 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 7 | // コードが再生成されるときに損失したりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Selenium.CefSharp.Driver.InTarget.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 17 | /// 18 | // このクラスは StronglyTypedResourceBuilder クラスが ResGen 19 | // または Visual Studio のようなツールを使用して自動生成されました。 20 | // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に 21 | // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Selenium.CefSharp.Driver.InTarget.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします 51 | /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// using CefSharp; 65 | ///using System; 66 | ///using System.Collections.Generic; 67 | ///using System.Diagnostics; 68 | ///using System.Runtime.InteropServices; 69 | ///using System.Text; 70 | /// 71 | ///namespace Selenium.CefSharp.Driver 72 | ///{ 73 | /// public class CefSharpWindowManager : ILifeSpanHandler 74 | /// { 75 | /// public class BrowserInfo 76 | /// { 77 | /// public IntPtr WindowHandle; 78 | /// public IBrowser Browser; 79 | /// } 80 | /// 81 | /// public List<BrowserInfo> Browsers = new List<BrowserInfo>(); 82 | /// List<IntPtr> _beforeOpen = null; 83 | /// 84 | /// [残りの文字列は切り詰められました]"; に類似しているローカライズされた文字列を検索します。 85 | /// 86 | internal static string CefSharpWindowManager { 87 | get { 88 | return ResourceManager.GetString("CefSharpWindowManager", resourceCulture); 89 | } 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver.InTarget/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Src\CefSharpWindowManager.cs;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 123 | 124 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver.InTarget/ReflectionAccessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Linq; 4 | using System.Collections.Generic; 5 | 6 | namespace Selenium.CefSharp.Driver.InTarget 7 | { 8 | public class ReflectionAccessor 9 | { 10 | static Dictionary _fullNameAndType = new Dictionary(); 11 | 12 | public object Object { get; } 13 | 14 | public ReflectionAccessor(object obj) => Object = obj; 15 | 16 | public T GetProperty(string name) 17 | => (T)Object.GetType().GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).GetValue(Object, new object[0]); 18 | 19 | public T GetField(string name) 20 | { 21 | var type = Object.GetType(); 22 | while (type != null) 23 | { 24 | var field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); 25 | if (field != null) 26 | { 27 | return (T)field.GetValue(Object); 28 | } 29 | type = type.BaseType; 30 | } 31 | throw new NotSupportedException(); 32 | } 33 | 34 | public T InvokeMethod(string name, params object[] args) 35 | => (T)Object.GetType().GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Invoke(Object, args); 36 | 37 | public T InvokeMethodByType(string name, params object[] args) 38 | => (T)Object.GetType().GetMethod(name, args.Select(e => e.GetType()).ToArray()).Invoke(Object, args); 39 | 40 | public static Type GetType(string typeFullName) 41 | { 42 | lock (_fullNameAndType) 43 | { 44 | if (_fullNameAndType.TryGetValue(typeFullName, out var type)) return type; 45 | 46 | var assemblies = AppDomain.CurrentDomain.GetAssemblies(); 47 | var assemblyTypes = new List(); 48 | foreach (Assembly assembly in assemblies) 49 | { 50 | type = assembly.GetType(typeFullName); 51 | if (type != null) break; 52 | } 53 | if (type != null) 54 | { 55 | _fullNameAndType.Add(typeFullName, type); 56 | } 57 | return type; 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver.InTarget/Selenium.CefSharp.Driver.InTarget.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {3DD479EF-1A1C-49FF-83F7-76FFAA14DB1B} 8 | Library 9 | Properties 10 | Selenium.CefSharp.Driver.InTarget 11 | Selenium.CefSharp.Driver.InTarget 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | ..\packages\Codeer.TestAssistant.GeneratorToolKit.3.13.0\lib\net40\Codeer.TestAssistant.GeneratorToolKit.dll 36 | 37 | 38 | ..\packages\Codeer.TestAssistant.GeneratorToolKit.3.13.0\lib\net40\Codeer.TestAssistant.GeneratorToolKit.4.0.dll 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | True 59 | True 60 | Resources.resx 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | ResXFileCodeGenerator 69 | Resources.Designer.cs 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver.InTarget/Src/CefSharpWindowManager.cs: -------------------------------------------------------------------------------- 1 | using CefSharp; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | 8 | namespace Selenium.CefSharp.Driver 9 | { 10 | public class CefSharpWindowManager : ILifeSpanHandler 11 | { 12 | public class BrowserInfo 13 | { 14 | public IntPtr WindowHandle; 15 | public IBrowser Browser; 16 | } 17 | 18 | public List Browsers = new List(); 19 | List _beforeOpen = null; 20 | 21 | public bool OnBeforePopup(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, string targetUrl, 22 | string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, 23 | IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser) 24 | { 25 | _beforeOpen = GetWindows(); 26 | 27 | newBrowser = null; 28 | return false; 29 | } 30 | 31 | static IntPtr GetNewWindow(List before, List after) 32 | { 33 | foreach (var e in after) 34 | { 35 | if (!before.Contains(e)) return e; 36 | } 37 | return IntPtr.Zero; 38 | } 39 | 40 | public void OnAfterCreated(IWebBrowser chromiumWebBrowser, IBrowser browser) 41 | { 42 | if (_beforeOpen == null) return; 43 | 44 | var after = GetWindows(); 45 | var handle = GetNewWindow(_beforeOpen, after); 46 | _beforeOpen = null; 47 | if (handle == IntPtr.Zero) return; 48 | Browsers.Add(new BrowserInfo 49 | { 50 | WindowHandle = handle, 51 | Browser = browser 52 | }); 53 | } 54 | 55 | public bool DoClose(IWebBrowser chromiumWebBrowser, IBrowser browser) 56 | { 57 | return false; 58 | } 59 | 60 | public void OnBeforeClose(IWebBrowser chromiumWebBrowser, IBrowser browser) 61 | { 62 | BrowserInfo info = null; 63 | foreach (var e in Browsers) 64 | { 65 | if (e.Browser.Identifier == browser.Identifier) 66 | { 67 | info = e; 68 | break; 69 | } 70 | } 71 | Browsers.Remove(info); 72 | } 73 | 74 | public List GetWindowHandles() 75 | { 76 | var list = new List(); 77 | foreach (var e in Browsers) 78 | { 79 | list.Add(e.WindowHandle); 80 | } 81 | return list; 82 | } 83 | 84 | public IBrowser GetBrowser(IntPtr windowHandle) 85 | { 86 | foreach (var e in Browsers) 87 | { 88 | if (e.WindowHandle == windowHandle) return e.Browser; 89 | } 90 | return null; 91 | } 92 | 93 | static List GetWindows() 94 | { 95 | int processId = Process.GetCurrentProcess().Id; 96 | 97 | var handles = new List(); 98 | EnumWindowsDelegate enumWindows = (IntPtr hwnd, IntPtr lparam) => 99 | { 100 | if (!IsWindow(hwnd) || !IsWindowVisible(hwnd) || !IsWindowEnabled(hwnd)) return true; 101 | 102 | int windowProcessId = 0; 103 | GetWindowThreadProcessId(hwnd, out windowProcessId); 104 | if (processId != windowProcessId) return true; 105 | handles.Add(hwnd); 106 | return true; 107 | }; 108 | 109 | EnumWindows(enumWindows, IntPtr.Zero); 110 | GC.KeepAlive(enumWindows); 111 | 112 | return handles; 113 | } 114 | 115 | [DllImport("user32.dll", CharSet = CharSet.Auto)] 116 | static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount); 117 | 118 | [DllImport("user32.dll")] 119 | [return: MarshalAs(UnmanagedType.Bool)] 120 | static extern bool IsWindowEnabled(IntPtr hWnd); 121 | 122 | [DllImport("user32.dll")] 123 | static extern int GetWindowThreadProcessId(IntPtr hWnd, out int lpdwProcessId); 124 | 125 | [DllImport("user32.dll")] 126 | [return: MarshalAs(UnmanagedType.Bool)] 127 | static extern bool IsWindowVisible(IntPtr hWnd); 128 | 129 | [DllImport("user32.dll")] 130 | [return: MarshalAs(UnmanagedType.Bool)] 131 | static extern bool IsWindow(IntPtr hWnd); 132 | 133 | [DllImport("user32.dll", CharSet = CharSet.Auto)] 134 | static extern int EnumWindows(EnumWindowsDelegate lpEnumFunc, IntPtr lparam); 135 | 136 | delegate bool EnumWindowsDelegate(IntPtr hWnd, IntPtr lparam); 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver.InTarget/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29409.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Selenium.CefSharp.Driver", "Selenium.CefSharp.Driver\Selenium.CefSharp.Driver.csproj", "{D4E61820-4BCE-4CEE-8DAE-924C9F8CC9F0}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Selenium.CefSharp.Driver.InTarget", "Selenium.CefSharp.Driver.InTarget\Selenium.CefSharp.Driver.InTarget.csproj", "{3DD479EF-1A1C-49FF-83F7-76FFAA14DB1B}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{ED3FF6AE-91E8-4CDB-B6D6-44DF0A2CC712}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{26AD8B74-3D23-4510-8FEB-7EC3FE309B75}" 13 | ProjectSection(SolutionItems) = preProject 14 | .nuget\Selenium.CefSharp.Driver.nuspec = .nuget\Selenium.CefSharp.Driver.nuspec 15 | EndProjectSection 16 | EndProject 17 | Global 18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 19 | Debug|Any CPU = Debug|Any CPU 20 | Release|Any CPU = Release|Any CPU 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {D4E61820-4BCE-4CEE-8DAE-924C9F8CC9F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 24 | {D4E61820-4BCE-4CEE-8DAE-924C9F8CC9F0}.Debug|Any CPU.Build.0 = Debug|Any CPU 25 | {D4E61820-4BCE-4CEE-8DAE-924C9F8CC9F0}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {D4E61820-4BCE-4CEE-8DAE-924C9F8CC9F0}.Release|Any CPU.Build.0 = Release|Any CPU 27 | {3DD479EF-1A1C-49FF-83F7-76FFAA14DB1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 28 | {3DD479EF-1A1C-49FF-83F7-76FFAA14DB1B}.Debug|Any CPU.Build.0 = Debug|Any CPU 29 | {3DD479EF-1A1C-49FF-83F7-76FFAA14DB1B}.Release|Any CPU.ActiveCfg = Release|Any CPU 30 | {3DD479EF-1A1C-49FF-83F7-76FFAA14DB1B}.Release|Any CPU.Build.0 = Release|Any CPU 31 | {ED3FF6AE-91E8-4CDB-B6D6-44DF0A2CC712}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 32 | {ED3FF6AE-91E8-4CDB-B6D6-44DF0A2CC712}.Debug|Any CPU.Build.0 = Debug|Any CPU 33 | {ED3FF6AE-91E8-4CDB-B6D6-44DF0A2CC712}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {ED3FF6AE-91E8-4CDB-B6D6-44DF0A2CC712}.Release|Any CPU.Build.0 = Release|Any CPU 35 | EndGlobalSection 36 | GlobalSection(SolutionProperties) = preSolution 37 | HideSolutionNode = FALSE 38 | EndGlobalSection 39 | GlobalSection(ExtensibilityGlobals) = postSolution 40 | SolutionGuid = {3B104A57-B87D-40CF-947D-A424E77215F6} 41 | EndGlobalSection 42 | EndGlobal 43 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/Inside/Alert.cs: -------------------------------------------------------------------------------- 1 | using Codeer.Friendly.Dynamic; 2 | using Codeer.Friendly.Windows; 3 | using Codeer.Friendly.Windows.Grasp; 4 | using Codeer.Friendly.Windows.KeyMouse; 5 | using OpenQA.Selenium; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using static Selenium.CefSharp.Driver.Inside.NativeMethods; 11 | 12 | namespace Selenium.CefSharp.Driver.Inside 13 | { 14 | class Alert : IAlert 15 | { 16 | WindowsAppFriend _app; 17 | WindowControl _editor; 18 | WindowControl _ok; 19 | WindowControl _cancel; 20 | WindowControl _message; 21 | 22 | public string Text => _message == null ? string.Empty : _message.GetWindowText(); 23 | 24 | public Alert(WindowsAppFriend driverApp) 25 | { 26 | int processId = driverApp.ProcessId; 27 | int currentThreadId = driverApp.Type(typeof(Codeer.Friendly.Windows.Grasp.Inside.NativeMethods)).GetCurrentThreadId(); 28 | 29 | var handles = new List(); 30 | EnumWindowsDelegate enumWindows = (IntPtr hwnd, IntPtr lparam) => 31 | { 32 | if (!IsWindow(hwnd) || !IsWindowVisible(hwnd) || !IsWindowEnabled(hwnd)) return true; 33 | 34 | GetWindowThreadProcessId(hwnd, out var windowProcessId); 35 | if (processId != windowProcessId) return true; 36 | 37 | var sb = new StringBuilder(1024); 38 | GetWindowText(hwnd, sb, 1024); 39 | if (sb.ToString().IndexOf("JavaScript") == 0) 40 | { 41 | handles.Add(hwnd); 42 | } 43 | return true; 44 | }; 45 | 46 | EnumWindows(enumWindows, IntPtr.Zero); 47 | GC.KeepAlive(enumWindows); 48 | 49 | if (0 < handles.Count) 50 | { 51 | _app = new WindowsAppFriend(handles[0]); 52 | var win = new WindowControl(_app, handles[0]); 53 | _editor = win.GetFromWindowClass("Edit").FirstOrDefault(); 54 | _ok = win.GetFromWindowClass("Button").Where(e => e.GetWindowText() == "OK").FirstOrDefault(); 55 | _cancel = win.GetFromWindowClass("Button").Where(e => e.GetWindowText() == "Cancel").FirstOrDefault(); 56 | _message = win.GetFromWindowClass("Static").FirstOrDefault(); 57 | } 58 | } 59 | 60 | public void Accept() 61 | { 62 | if (_ok == null) return; 63 | 64 | while (_ok.IsWindow()) 65 | { 66 | _ok.Activate(); 67 | _ok.Click(); 68 | } 69 | } 70 | 71 | public void Dismiss() 72 | { 73 | if (_cancel == null) return; 74 | 75 | while (_cancel.IsWindow()) 76 | { 77 | _cancel.Activate(); 78 | _cancel.Click(); 79 | } 80 | } 81 | 82 | public void SendKeys(string keysToSend) 83 | { 84 | if (_editor == null) return; 85 | _editor.Activate(); 86 | KeySpec.SendKeys(_editor.App, keysToSend); 87 | } 88 | 89 | public void SetAuthenticationCredentials(string userName, string password) 90 | { 91 | //TODO not test. 92 | _app.SendKeys(userName); 93 | _app.SendKey(System.Windows.Forms.Keys.Tab); 94 | _app.SendKeys(password); 95 | _app.SendKey(System.Windows.Forms.Keys.Enter); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/Inside/ApplicationCache.cs: -------------------------------------------------------------------------------- 1 | using OpenQA.Selenium; 2 | using OpenQA.Selenium.Html5; 3 | using System; 4 | using System.Globalization; 5 | 6 | namespace Selenium.CefSharp.Driver.Inside 7 | { 8 | class ApplicationCache : IApplicationCache 9 | { 10 | IJavaScriptExecutor _javaScriptExecutor; 11 | 12 | public AppCacheStatus Status 13 | => (AppCacheStatus)Convert.ToInt32(_javaScriptExecutor.ExecuteScript("window.applicationCache.status"), CultureInfo.InvariantCulture); 14 | 15 | internal ApplicationCache(IJavaScriptExecutor javaScriptExecutor) 16 | => _javaScriptExecutor = javaScriptExecutor; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/Inside/CefSharpFrameDriver.cs: -------------------------------------------------------------------------------- 1 | using Codeer.Friendly; 2 | using Codeer.Friendly.Dynamic; 3 | using Codeer.Friendly.Windows; 4 | using Codeer.Friendly.Windows.Grasp; 5 | using OpenQA.Selenium; 6 | using System; 7 | using System.Drawing; 8 | using System.Linq; 9 | 10 | namespace Selenium.CefSharp.Driver.Inside 11 | { 12 | class CefSharpFrameDriver : 13 | IAppVarOwner, 14 | IUIObject, 15 | IJavaScriptExecutor 16 | { 17 | readonly JavaScriptAdaptor _javaScriptAdaptor; 18 | readonly Func _frameGetter; 19 | readonly CotnrolAccessor _cotnrolAccessor; 20 | 21 | public WindowsAppFriend App => (WindowsAppFriend)AppVar.App; 22 | 23 | public AppVar AppVar => _frameGetter(); 24 | 25 | public AppVar JavascriptObjectRepository => CefSharpDriver.JavascriptObjectRepository; 26 | 27 | public Size Size => FrameElements.Any() ? FrameElements.Last().Size : CefSharpDriver.CurrentBrowser.Size; 28 | 29 | internal string Url 30 | { 31 | get => (string)ExecuteScript("return window.location.href;"); 32 | set 33 | { 34 | this.Dynamic().LoadUrl(value); 35 | WaitForLoading(); 36 | } 37 | } 38 | 39 | internal CefSharpDriver CefSharpDriver { get; } 40 | 41 | internal CefSharpFrameDriver ParentFrame { get; } 42 | 43 | internal IWebElement[] FrameElements { get; } 44 | 45 | internal string Title => (string)ExecuteScript("return document.title;"); 46 | 47 | internal CefSharpFrameDriver(CefSharpDriver cefSharpDriver, CefSharpFrameDriver parentFrame, Func frameGetter, IWebElement[] frameElement) 48 | { 49 | ParentFrame = parentFrame; 50 | _javaScriptAdaptor = new JavaScriptAdaptor(this); 51 | CefSharpDriver = cefSharpDriver; 52 | _frameGetter = frameGetter; 53 | FrameElements = frameElement; 54 | _cotnrolAccessor = new CotnrolAccessor(this); 55 | } 56 | 57 | public object ExecuteScript(string script, params object[] args) 58 | => _javaScriptAdaptor.ExecuteScript(script, args); 59 | 60 | public object ExecuteAsyncScript(string script, params object[] args) 61 | => _javaScriptAdaptor.ExecuteAsyncScript(script, args); 62 | 63 | public void WaitForLoading() 64 | => CefSharpDriver.CurrentBrowser.WaitForLoading(); 65 | 66 | public Point PointToScreen(Point clientPoint) 67 | { 68 | var offset = new Point(); 69 | foreach (var e in FrameElements) 70 | { 71 | offset.Offset(e.Location); 72 | } 73 | clientPoint.Offset(offset); 74 | return CefSharpDriver.CurrentBrowser.PointToScreen(clientPoint); 75 | } 76 | 77 | public void Activate() 78 | => CefSharpDriver.CurrentBrowser.Activate(); 79 | 80 | public IWebElement CreateWebElement(int id) 81 | => new CefSharpWebElement(this, _cotnrolAccessor, id); 82 | 83 | public Screenshot GetScreenshot() 84 | => _cotnrolAccessor.GetScreenShot(new Point(0, 0), Size); 85 | 86 | public override bool Equals(object obj) 87 | { 88 | var target = obj as CefSharpFrameDriver; 89 | if (target == null) return false; 90 | return this.Dynamic().Identifier.Equals(target.Dynamic().Identifier); 91 | } 92 | 93 | public override int GetHashCode() => this.Dynamic().Identifier; 94 | 95 | public object ExecuteScript(PinnedScript script, params object[] args) 96 | { 97 | // PinnedScriptの詳細不明 98 | throw new NotImplementedException(); 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/Inside/CefSharpWindowBrowser.cs: -------------------------------------------------------------------------------- 1 | using Codeer.Friendly; 2 | using Codeer.Friendly.Windows; 3 | using Codeer.Friendly.Windows.Grasp; 4 | using OpenQA.Selenium; 5 | using System; 6 | using System.Drawing; 7 | using Codeer.Friendly.Dynamic; 8 | using Selenium.CefSharp.Driver.InTarget; 9 | using System.Threading; 10 | using static Selenium.CefSharp.Driver.Inside.NativeMethods; 11 | 12 | namespace Selenium.CefSharp.Driver.Inside 13 | { 14 | class CefSharpWindowBrowser : ICefSharpBrowser 15 | { 16 | WindowControl _core; 17 | 18 | public IntPtr WindowHandle { get; } 19 | 20 | public WindowsAppFriend App => _core.App; 21 | 22 | public Size Size => _core.Size; 23 | 24 | public CefSharpFrameDriver MainFrame { get; } 25 | 26 | public CefSharpFrameDriver CurrentFrame { get; set; } 27 | 28 | public AppVar BrowserCore { get; } 29 | 30 | public CefSharpWindowBrowser(CefSharpDriver driver, IntPtr window, AppVar browser) 31 | { 32 | WindowHandle = window; 33 | _core = new WindowControl((WindowsAppFriend)browser.App, GetWindow(window, GW_CHILD)); 34 | BrowserCore = browser; 35 | MainFrame = CurrentFrame = new CefSharpFrameDriver(driver, null, () => (AppVar)App.Type().GetMainFrame(browser), new IWebElement[0]); 36 | } 37 | 38 | public void Activate() 39 | => _core.Activate(); 40 | 41 | public Point PointToScreen(Point clientPoint) 42 | => _core.PointToScreen(clientPoint); 43 | 44 | public void WaitForLoading() 45 | { 46 | while ((bool)BrowserCore.Dynamic().IsLoading) 47 | { 48 | Thread.Sleep(10); 49 | } 50 | } 51 | 52 | public void Close() 53 | => new WindowControl(App, WindowHandle).Close(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/Inside/ChromiumWebBrowserDriver.cs: -------------------------------------------------------------------------------- 1 | using Codeer.Friendly; 2 | using Codeer.Friendly.Dynamic; 3 | using Codeer.Friendly.Windows; 4 | using Codeer.Friendly.Windows.Grasp; 5 | using System; 6 | using System.Threading; 7 | using Selenium.CefSharp.Driver.InTarget; 8 | using Codeer.Friendly.DotNetExecutor; 9 | using System.Drawing; 10 | using OpenQA.Selenium; 11 | 12 | namespace Selenium.CefSharp.Driver.Inside 13 | { 14 | class ChromiumWebBrowserDriver : 15 | IAppVarOwner, 16 | ICefSharpBrowser 17 | { 18 | readonly dynamic _webBrowserExtensions; 19 | 20 | public WindowsAppFriend App => (WindowsAppFriend)AppVar.App; 21 | 22 | public AppVar AppVar { get; } 23 | 24 | public CefSharpFrameDriver MainFrame { get; } 25 | 26 | public CefSharpFrameDriver CurrentFrame { get; set; } 27 | 28 | public Size Size 29 | { 30 | get 31 | { 32 | if (IsWPF) 33 | { 34 | var size = this.Dynamic().RenderSize; 35 | return new Size((int)(double)size.Width, (int)(double)size.Height); 36 | } 37 | return new WindowControl(this.AppVar).Size; 38 | } 39 | } 40 | 41 | bool IsWPF 42 | { 43 | get 44 | { 45 | var finder = App.Type()(); 46 | var wpfType = (AppVar)finder.GetType("CefSharp.Wpf.ChromiumWebBrowser"); 47 | var t = this.Dynamic().GetType(); 48 | var isWPF = !wpfType.IsNull && (bool)wpfType["IsAssignableFrom", new OperationTypeInfo(typeof(Type).FullName, typeof(Type).FullName)]((AppVar)t).Core; 49 | return isWPF; 50 | } 51 | } 52 | 53 | public AppVar BrowserCore => this.Dynamic().GetBrowser(); 54 | 55 | public IntPtr WindowHandle => IntPtr.Zero; 56 | 57 | internal dynamic JavascriptObjectRepository => this.Dynamic().JavascriptObjectRepository; 58 | 59 | internal ChromiumWebBrowserDriver(CefSharpDriver driver) 60 | { 61 | AppVar = driver.AppVar; 62 | App.LoadAssembly(typeof(JSResultConverter).Assembly); 63 | _webBrowserExtensions = App.Type("CefSharp.WebBrowserExtensions"); 64 | 65 | MainFrame = CurrentFrame = new CefSharpFrameDriver(driver, null, () => (AppVar)GetMainFrame(), new IWebElement[0]); 66 | 67 | } 68 | 69 | public Point PointToScreen(Point clientPoint) 70 | { 71 | if (IsWPF) 72 | { 73 | var pos = this.Dynamic().PointToScreen(App.Type("System.Windows.Point")((double)clientPoint.X, (double)clientPoint.Y)); 74 | return new Point((int)(double)pos.X, (int)(double)pos.Y); 75 | } 76 | return new WindowControl(AppVar).PointToScreen(clientPoint); 77 | } 78 | 79 | public void Activate() 80 | { 81 | if (IsWPF) 82 | { 83 | var source = App.Type("System.Windows.Interop.HwndSource").FromVisual(this); 84 | new WindowControl(App, (IntPtr)source.Handle).Activate(); 85 | } 86 | else 87 | { 88 | new WindowControl(AppVar).Activate(); 89 | } 90 | this.Dynamic().Focus(); 91 | } 92 | 93 | public void WaitForLoading() 94 | { 95 | while ((bool)this.Dynamic().IsLoading) 96 | { 97 | Thread.Sleep(10); 98 | } 99 | } 100 | 101 | internal dynamic GetMainFrame() 102 | => _webBrowserExtensions.GetMainFrame(this); 103 | 104 | internal void ShowDevTools() 105 | => _webBrowserExtensions.ShowDevTools(this); 106 | 107 | public void Close() 108 | { 109 | WindowControl window = null; 110 | if (IsWPF) 111 | { 112 | IntPtr handle = App.Type("System.Windows.Interop.HwndSource").FromVisual(this).Handle; 113 | new WindowControl(App, handle).Close(); 114 | } 115 | else 116 | { 117 | window = new WindowControl(AppVar); 118 | while (window.ParentWindow != null) window = window.ParentWindow; 119 | } 120 | window.Close(); 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/Inside/ClickSpeck.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Selenium.CefSharp.Driver.Inside 4 | { 5 | static class ClickSpeck 6 | { 7 | internal static void Click(CefSharpWebElement element) 8 | { 9 | if (element.TagName.Equals("OPTION", StringComparison.InvariantCultureIgnoreCase)) 10 | { 11 | var parent = element.GetParentElement(); 12 | 13 | //TODO: emulate mouse down / up 14 | //https://www.w3.org/TR/webdriver/#element-click 15 | 16 | parent.Focus(); 17 | 18 | if (!parent.Enabled) 19 | { 20 | return; 21 | } 22 | var script = $@" 23 | const element = window.__seleniumCefSharpDriver.getElementByEntryId({element.Id}); 24 | element.selected = true"; 25 | 26 | if (parent.GetProperty("multiple").Equals("true", StringComparison.InvariantCultureIgnoreCase)) 27 | { 28 | script = $@" 29 | const element = window.__seleniumCefSharpDriver.getElementByEntryId({element.Id}); 30 | element.selected = !element.selected"; 31 | } 32 | element.JavaScriptExecutor.ExecuteScript(script); 33 | element.JavaScriptExecutor.ExecuteScript("arguments[0].dispatchEvent(new Event('change', {bubbles: true, composed: true}))", parent); 34 | } 35 | else 36 | { 37 | if (!element.HitTestCenter()) 38 | { 39 | element.ScrollIntoView(); 40 | } 41 | var pos = element.Location; 42 | var size = element.Size; 43 | pos.Offset(size.Width / 2, size.Height / 2); 44 | element.CotnrolAccessor.Click(pos); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/Inside/Coordinates.cs: -------------------------------------------------------------------------------- 1 | using OpenQA.Selenium.Interactions.Internal; 2 | using System; 3 | 4 | namespace Selenium.CefSharp.Driver.Inside 5 | { 6 | class Coordinates : ICoordinates 7 | { 8 | CefSharpWebElement _element; 9 | 10 | public System.Drawing.Point LocationOnScreen => throw new NotImplementedException(); 11 | 12 | public System.Drawing.Point LocationInViewport => _element.LocationOnScreenOnceScrolledIntoView; 13 | 14 | public System.Drawing.Point LocationInDom => _element.Location; 15 | 16 | public object AuxiliaryLocator => _element.Id; 17 | 18 | public Coordinates(CefSharpWebElement element) 19 | => _element = element; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/Inside/CotnrolAccessor.cs: -------------------------------------------------------------------------------- 1 | using Codeer.Friendly.Windows.Grasp; 2 | using Codeer.Friendly.Windows.KeyMouse; 3 | using OpenQA.Selenium; 4 | using System; 5 | using System.Drawing; 6 | using System.Drawing.Imaging; 7 | using System.IO; 8 | 9 | namespace Selenium.CefSharp.Driver.Inside 10 | { 11 | class CotnrolAccessor 12 | { 13 | IUIObject _uiObject; 14 | 15 | internal CotnrolAccessor(IUIObject uiObject) 16 | => _uiObject = uiObject; 17 | 18 | internal Screenshot GetScreenShot(Point location, Size size) 19 | { 20 | _uiObject.Activate(); 21 | using (var bmp = new Bitmap(size.Width, size.Height)) 22 | using (var g = Graphics.FromImage(bmp)) 23 | { 24 | g.CopyFromScreen(_uiObject.PointToScreen(location), new Point(0, 0), bmp.Size); 25 | using (var ms = new MemoryStream()) 26 | { 27 | bmp.Save(ms, ImageFormat.Bmp); 28 | return new Screenshot(Convert.ToBase64String(ms.ToArray())); 29 | } 30 | } 31 | } 32 | 33 | internal void Click(Point location) 34 | => _uiObject.Click(MouseButtonType.Left, location); 35 | 36 | internal void SendKeys(string text) 37 | { 38 | _uiObject.Activate(); 39 | KeySpec.SendKeys(_uiObject.App, text); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/Inside/ICefSharpBrowser.cs: -------------------------------------------------------------------------------- 1 | using Codeer.Friendly; 2 | using Codeer.Friendly.Windows.Grasp; 3 | using System; 4 | 5 | namespace Selenium.CefSharp.Driver.Inside 6 | { 7 | interface ICefSharpBrowser : IUIObject 8 | { 9 | CefSharpFrameDriver MainFrame { get; } 10 | CefSharpFrameDriver CurrentFrame { get; set; } 11 | AppVar BrowserCore { get; } 12 | IntPtr WindowHandle { get; } 13 | void WaitForLoading(); 14 | void Close(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/Inside/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | namespace Selenium.CefSharp.Driver.Inside 7 | { 8 | static class NativeMethods 9 | { 10 | internal const int GW_CHILD = 5; 11 | 12 | [DllImport("user32.dll", CharSet = CharSet.Auto)] 13 | internal static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount); 14 | 15 | [DllImport("user32.dll")] 16 | [return: MarshalAs(UnmanagedType.Bool)] 17 | internal static extern bool IsWindowEnabled(IntPtr hWnd); 18 | 19 | [DllImport("user32.dll")] 20 | internal static extern int GetWindowThreadProcessId(IntPtr hWnd, out int lpdwProcessId); 21 | 22 | [DllImport("user32.dll")] 23 | [return: MarshalAs(UnmanagedType.Bool)] 24 | internal static extern bool IsWindowVisible(IntPtr hWnd); 25 | 26 | [DllImport("user32.dll")] 27 | [return: MarshalAs(UnmanagedType.Bool)] 28 | internal static extern bool IsWindow(IntPtr hWnd); 29 | 30 | [DllImport("user32.dll", CharSet = CharSet.Auto)] 31 | internal static extern int EnumWindows(EnumWindowsDelegate lpEnumFunc, IntPtr lparam); 32 | 33 | [DllImport("user32.dll", SetLastError = true)] 34 | internal static extern IntPtr GetWindow(IntPtr hWnd, int uCmd); 35 | 36 | internal delegate bool EnumWindowsDelegate(IntPtr hWnd, IntPtr lparam); 37 | 38 | internal static List GetWindows(int processId) 39 | { 40 | var handles = new List(); 41 | EnumWindowsDelegate enumWindows = (IntPtr hwnd, IntPtr lparam) => 42 | { 43 | if (!IsWindow(hwnd) || !IsWindowVisible(hwnd) || !IsWindowEnabled(hwnd)) return true; 44 | 45 | GetWindowThreadProcessId(hwnd, out var windowProcessId); 46 | if (processId != windowProcessId) return true; 47 | handles.Add(hwnd); 48 | return true; 49 | }; 50 | 51 | EnumWindows(enumWindows, IntPtr.Zero); 52 | GC.KeepAlive(enumWindows); 53 | 54 | return handles; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/Inside/Storag.cs: -------------------------------------------------------------------------------- 1 | using OpenQA.Selenium; 2 | using OpenQA.Selenium.Html5; 3 | using System; 4 | using System.Collections; 5 | using System.Collections.Generic; 6 | using System.Collections.ObjectModel; 7 | using System.Globalization; 8 | 9 | namespace Selenium.CefSharp.Driver.Inside 10 | { 11 | class Storag : ILocalStorage, ISessionStorage 12 | { 13 | readonly IJavaScriptExecutor _javaScriptExecutor; 14 | readonly string _storageName; 15 | 16 | public int Count => Convert.ToInt32(_javaScriptExecutor.ExecuteScript($"return window.{_storageName}.length;"), CultureInfo.InvariantCulture); 17 | 18 | public Storag(IJavaScriptExecutor javaScriptExecutor, string storageName) 19 | { 20 | _javaScriptExecutor = javaScriptExecutor; 21 | _storageName = storageName; 22 | } 23 | 24 | public void Clear() 25 | => _javaScriptExecutor.ExecuteScript($"window.{_storageName}.clear();"); 26 | 27 | public string GetItem(string key) 28 | => (string)_javaScriptExecutor.ExecuteScript($"return window.{_storageName}.getItem('{key}');"); 29 | 30 | public ReadOnlyCollection KeySet() 31 | { 32 | var list = new List(); 33 | foreach (var e in (IEnumerable)_javaScriptExecutor.ExecuteScript($"return Object.keys(window.{_storageName});")) 34 | { 35 | list.Add(e?.ToString()); 36 | } 37 | return new ReadOnlyCollection(list); 38 | } 39 | 40 | public string RemoveItem(string key) 41 | { 42 | var value = GetItem(key); 43 | _javaScriptExecutor.ExecuteScript($"window.{_storageName}.removeItem('{key}');"); 44 | return value; 45 | } 46 | 47 | public void SetItem(string key, string value) 48 | => _javaScriptExecutor.ExecuteScript($"window.{_storageName}.setItem('{key}', '{value}');"); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/Inside/WebStorage.cs: -------------------------------------------------------------------------------- 1 | using OpenQA.Selenium; 2 | using OpenQA.Selenium.Html5; 3 | 4 | namespace Selenium.CefSharp.Driver.Inside 5 | { 6 | class WebStorage : IWebStorage 7 | { 8 | public ILocalStorage LocalStorage { get; } 9 | 10 | public ISessionStorage SessionStorage { get; } 11 | 12 | public WebStorage(IJavaScriptExecutor javaScriptExecutor) 13 | { 14 | LocalStorage = new Storag(javaScriptExecutor, "localStorage"); 15 | SessionStorage = new Storag(javaScriptExecutor, "sessionStorage"); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 6 | // 制御されます。アセンブリに関連付けられている情報を変更するには、 7 | // これらの属性値を変更してください。 8 | [assembly: AssemblyTitle("Selenium.CefSharp.Driver")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Selenium.CefSharp.Driver")] 13 | [assembly: AssemblyCopyright("Copyright © 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから 18 | // 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 19 | // その型の ComVisible 属性を true に設定してください。 20 | [assembly: ComVisible(false)] 21 | 22 | // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります 23 | [assembly: Guid("d4e61820-4bce-4cee-8dae-924c9f8cc9f0")] 24 | 25 | // アセンブリのバージョン情報は、以下の 4 つの値で構成されています: 26 | // 27 | // メジャー バージョン 28 | // マイナー バージョン 29 | // ビルド番号 30 | // リビジョン 31 | // 32 | // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます 33 | // 既定値にすることができます: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("0.14.2.0")] 36 | [assembly: AssemblyFileVersion("0.14.2.0")] 37 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/Selenium.CefSharp.Driver.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {D4E61820-4BCE-4CEE-8DAE-924C9F8CC9F0} 8 | Library 9 | Properties 10 | Selenium.CefSharp.Driver 11 | Selenium.CefSharp.Driver 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | bin\Debug\Selenium.CefSharp.Driver.xml 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | bin\Release\Selenium.CefSharp.Driver.xml 35 | 36 | 37 | 38 | ..\packages\Codeer.Friendly.2.6.1\lib\net40\Codeer.Friendly.dll 39 | 40 | 41 | ..\packages\Codeer.Friendly.2.6.1\lib\net40\Codeer.Friendly.Dynamic.dll 42 | 43 | 44 | ..\packages\Codeer.Friendly.Windows.2.16.0\lib\net20\Codeer.Friendly.Windows.dll 45 | 46 | 47 | ..\packages\Codeer.Friendly.Windows.Grasp.2.14.1\lib\net35\Codeer.Friendly.Windows.Grasp.2.0.dll 48 | 49 | 50 | ..\packages\Codeer.Friendly.Windows.Grasp.2.14.1\lib\net35\Codeer.Friendly.Windows.Grasp.3.5.dll 51 | 52 | 53 | ..\packages\Codeer.Friendly.Windows.KeyMouse.1.3.18\lib\net35\Codeer.Friendly.Windows.KeyMouse.2.0.dll 54 | 55 | 56 | ..\packages\Codeer.Friendly.Windows.KeyMouse.1.3.18\lib\net35\Codeer.Friendly.Windows.KeyMouse.3.5.dll 57 | 58 | 59 | ..\packages\Codeer.TestAssistant.GeneratorToolKit.3.13.0\lib\net40\Codeer.TestAssistant.GeneratorToolKit.dll 60 | 61 | 62 | ..\packages\Codeer.TestAssistant.GeneratorToolKit.3.13.0\lib\net40\Codeer.TestAssistant.GeneratorToolKit.4.0.dll 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | ..\packages\Selenium.WebDriver.4.0.1\lib\net45\WebDriver.dll 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | {3dd479ef-1a1c-49ff-83f7-76ffaa14db1b} 102 | Selenium.CefSharp.Driver.InTarget 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | if $(ConfigurationName) == Release "../../../.nuget/nuget" pack "../../../.nuget/Selenium.CefSharp.Driver.nuspec" 112 | 113 | 114 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Project/Selenium.CefSharp.Driver/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Project/Test/FrameTest.cs: -------------------------------------------------------------------------------- 1 | using OpenQA.Selenium; 2 | using NUnit.Framework; 3 | using System.Threading; 4 | 5 | namespace Test 6 | { 7 | //TODO add many frame test. 8 | public abstract class FrameTest : CompareTestBase 9 | { 10 | public class Forms : FrameTest 11 | { 12 | public Forms() : base(new FormsAgent()) { } 13 | } 14 | public class Wpf : FrameTest 15 | { 16 | public Wpf() : base(new WpfAgent()) { } 17 | } 18 | public class Web : FrameTest 19 | { 20 | public Web() : base(new WebAgent()) { } 21 | } 22 | protected FrameTest(INeed need) : base(need) { } 23 | 24 | [SetUp] 25 | public void SetUp() 26 | => GetDriver().Url = HtmlServer.Instance.RootUrl + "Frame.html"; 27 | 28 | [Test] 29 | public void TestFrame() 30 | { 31 | Thread.Sleep(3000); 32 | 33 | var driver = GetDriver(); 34 | 35 | driver.SwitchTo().Frame(0); 36 | driver.FindElement(By.Id("textBoxName")).SendKeys("abc"); 37 | driver.SwitchTo().DefaultContent(); 38 | 39 | driver.SwitchTo().Frame(1); 40 | driver.SwitchTo().Frame(0); 41 | driver.FindElement(By.Id("inputJS")).Click(); 42 | driver.SwitchTo().DefaultContent(); 43 | 44 | driver.SwitchTo().Frame(2); 45 | var url = driver.Url; 46 | 47 | driver.Navigate().GoToUrl("https://github.com/Codeer-Software/Selenium.CefSharp.Driver"); 48 | driver.Url = HtmlServer.Instance.RootUrl + "Frame.html"; 49 | 50 | var y = driver.FindElement(By.Id("frameInput1")); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Project/Test/Html/Controls.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Controls for Test 5 | 6 | 7 | 8 | 9 | Title Controls 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Key Test: 18 | 19 | 20 | 21 | File: 22 | 23 | 24 | 25 | 26 | Name: 27 | 28 | 29 | 30 | Date: 31 | 32 | 33 | 34 | Gender: 35 | 36 | Man 37 | Woman 38 | 39 | 40 | 41 | Personal belongings: 42 | 43 | Cell phone 44 | Casr 45 | Cottage 46 | 47 | 48 | 49 | Favorite fruit: 50 | 51 | 52 | Apple 53 | Orange 54 | Banana 55 | Pinapple 56 | 57 | 58 | 59 | 60 | 61 | Please describe the free opinion 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | Transfer to Frame.html 86 | Transfer to Frame.html 87 | Go to Frame.html 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | Single Select 97 | 98 | ABCDE 99 | FGHIJ 100 | KLMNO 101 | PQRST 102 | UVWXY 103 | Z 104 | 105 | 106 | 107 | Multiple Select 108 | 109 | ABCDE 110 | FGHIJ 111 | KLMNO 112 | PQRST 113 | UVWXY 114 | Z 115 | 116 | 117 | 118 | 119 | 120 | 121 | 161 | Transfer to Frame.html 162 | 163 | Shadow root test 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /Project/Test/Html/Frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Frame1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Project/Test/Html/FrameInner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Frame2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Project/Test/Html/Window.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Frame1 5 | 6 | 7 | 8 | Control 9 | 10 | 11 | -------------------------------------------------------------------------------- /Project/Test/Html/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codeer-Software/Selenium.CefSharp.Driver/c090dd7569175ce68d96e79db1a306895d85b3ce/Project/Test/Html/favicon.ico -------------------------------------------------------------------------------- /Project/Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("Test")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("Test")] 10 | [assembly: AssemblyCopyright("Copyright © 2019")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | 14 | [assembly: ComVisible(false)] 15 | 16 | [assembly: Guid("ed3ff6ae-91e8-4cdb-b6d6-44df0a2cc712")] 17 | 18 | // [assembly: AssemblyVersion("1.0.*")] 19 | [assembly: AssemblyVersion("1.0.0.0")] 20 | [assembly: AssemblyFileVersion("1.0.0.0")] 21 | -------------------------------------------------------------------------------- /Project/Test/SelectElementTest.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using OpenQA.Selenium; 3 | using OpenQA.Selenium.Support.UI; 4 | using System.Linq; 5 | 6 | namespace Test 7 | { 8 | public abstract class SelectElementTest : CompareTestBase 9 | { 10 | public class Forms : SelectElementTest 11 | { 12 | public Forms() : base(new FormsAgent()) { } 13 | } 14 | public class Wpf : SelectElementTest 15 | { 16 | public Wpf() : base(new WpfAgent()) { } 17 | } 18 | public class Web : SelectElementTest 19 | { 20 | public Web() : base(new WebAgent()) { } 21 | } 22 | protected SelectElementTest(INeed need) : base(need) { } 23 | 24 | [SetUp] 25 | public void SetUp() 26 | => GetDriver().Url = HtmlServer.Instance.RootUrl + "Controls.html"; 27 | 28 | public void InitializeSelect() 29 | { 30 | GetExecutor().ExecuteScript("document.getElementById('singleSelect').selectedIndex = -1"); 31 | GetExecutor().ExecuteScript("document.getElementById('multipleSelect').selectedIndex = -1"); 32 | } 33 | 34 | [Test] 35 | public void Options() 36 | { 37 | InitializeSelect(); 38 | 39 | var select = GetDriver().FindElement(By.Id("singleSelect")); 40 | var elem = new SelectElement(select); 41 | var texts = elem.Options.Select(o => o.Text).ToList(); ; 42 | texts.Count.Is(6); 43 | texts[0].Is("ABCDE"); 44 | texts[1].Is("FGHIJ"); 45 | texts[2].Is("KLMNO"); 46 | texts[3].Is("PQRST"); 47 | texts[4].Is("UVWXY"); 48 | texts[5].Is("Z"); 49 | } 50 | 51 | [Test] 52 | public void IsMultiple_ShouldReturnFalseWhenSingleSelect() 53 | { 54 | InitializeSelect(); 55 | 56 | var select = GetDriver().FindElement(By.Id("singleSelect")); 57 | var elem = new SelectElement(select); 58 | elem.IsMultiple.IsFalse(); 59 | } 60 | 61 | [Test] 62 | public void IsMultiple_ShouldReturnTrueWhenMultipleSelect() 63 | { 64 | InitializeSelect(); 65 | 66 | var select = GetDriver().FindElement(By.Id("multipleSelect")); 67 | var elem = new SelectElement(select); 68 | elem.IsMultiple.IsTrue(); 69 | } 70 | 71 | [Test] 72 | public void SelectedOption_ShouldReturnSelectedOption() 73 | { 74 | InitializeSelect(); 75 | 76 | var select = GetDriver().FindElement(By.Id("singleSelect")); 77 | var elem = new SelectElement(select); 78 | GetExecutor().ExecuteScript("document.getElementById('singleSelect').selectedIndex = 1"); 79 | var option = elem.SelectedOption; 80 | 81 | option.Text.Is("FGHIJ"); 82 | } 83 | 84 | [Test] 85 | public void SelectedOption_ShouldThrowExeceptionWhenHasNoSelected() 86 | { 87 | InitializeSelect(); 88 | 89 | var select = GetDriver().FindElement(By.Id("singleSelect")); 90 | var elem = new SelectElement(select); 91 | AssertCompatible.ThrowsException(() => elem.SelectedOption); 92 | } 93 | 94 | [Test] 95 | public void AllSelectedOptions_ShouldReturnEmptyWhenHasNoSelected() 96 | { 97 | InitializeSelect(); 98 | 99 | var select = GetDriver().FindElement(By.Id("singleSelect")); 100 | var elem = new SelectElement(select); 101 | var selects = elem.AllSelectedOptions; 102 | selects.Count.Is(0); 103 | } 104 | 105 | [Test] 106 | public void AllSelectedOptions_ShouldReturnSelectedOption_single() 107 | { 108 | InitializeSelect(); 109 | 110 | var select = GetDriver().FindElement(By.Id("singleSelect")); 111 | var elem = new SelectElement(select); 112 | GetExecutor().ExecuteScript("document.getElementById('singleSelect').selectedIndex = 1"); 113 | var selects = elem.AllSelectedOptions; 114 | 115 | selects.Count.Is(1); 116 | selects[0].Text.Is("FGHIJ"); 117 | } 118 | 119 | [Test] 120 | public void AllSelectedOptions_ShouldReturnSelectedOption_multiple() 121 | { 122 | InitializeSelect(); 123 | 124 | var select = GetDriver().FindElement(By.Id("multipleSelect")); 125 | var elem = new SelectElement(select); 126 | GetExecutor().ExecuteScript("document.getElementById('multipleSelect').options[1].selected = true"); 127 | GetExecutor().ExecuteScript("document.getElementById('multipleSelect').options[3].selected = true"); 128 | GetExecutor().ExecuteScript("document.getElementById('multipleSelect').options[5].selected = true"); 129 | var selects = elem.AllSelectedOptions; 130 | 131 | selects.Count.Is(3); 132 | selects[0].Text.Is("FGHIJ"); 133 | selects[1].Text.Is("PQRST"); 134 | selects[2].Text.Is("Z"); 135 | } 136 | 137 | [Test] 138 | public void WrappedElement() 139 | { 140 | InitializeSelect(); 141 | 142 | var select = GetDriver().FindElement(By.Id("multipleSelect")); 143 | var elem = new SelectElement(select); 144 | 145 | elem.WrappedElement.IsSameReferenceAs(select); 146 | } 147 | 148 | [Test] 149 | public virtual void SelectByText() 150 | { 151 | InitializeSelect(); 152 | 153 | var select = GetDriver().FindElement(By.Id("singleSelect")); 154 | var elem = new SelectElement(select); 155 | elem.SelectByText("ABCDE"); 156 | var selectedValue = GetExecutor().ExecuteScript("return document.getElementById('singleSelect').value"); 157 | selectedValue.Is("1"); 158 | } 159 | 160 | [Test] 161 | public virtual void SelectByIndex() 162 | { 163 | InitializeSelect(); 164 | 165 | var select = GetDriver().FindElement(By.Id("singleSelect")); 166 | var elem = new SelectElement(select); 167 | elem.SelectByIndex(4); 168 | var selectedValue = GetExecutor().ExecuteScript("return document.getElementById('singleSelect').value"); 169 | selectedValue.Is("5"); 170 | } 171 | 172 | [Test] 173 | public virtual void SelectByValue() 174 | { 175 | InitializeSelect(); 176 | 177 | var select = GetDriver().FindElement(By.Id("singleSelect")); 178 | var elem = new SelectElement(select); 179 | elem.SelectByValue("2"); 180 | var selectedIndex = GetExecutor().ExecuteScript("return document.getElementById('singleSelect').selectedIndex"); 181 | selectedIndex.Is(1L); 182 | } 183 | 184 | [Test] 185 | public virtual void SelectEvent() 186 | { 187 | InitializeSelect(); 188 | 189 | var select = GetDriver().FindElement(By.Id("dropDownFruit")); 190 | var elem = new SelectElement(select); 191 | elem.SelectByText("Banana"); 192 | GetDriver().FindElement(By.Id("textBoxName")).GetAttribute("value").Is("select"); 193 | } 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /Project/Test/Utility/AppRunner.cs: -------------------------------------------------------------------------------- 1 | using Codeer.Friendly.Dynamic; 2 | using Codeer.Friendly.Windows; 3 | using Codeer.Friendly.Windows.Grasp; 4 | using Selenium.CefSharp.Driver; 5 | using System.Diagnostics; 6 | using System.IO; 7 | using System.Threading; 8 | 9 | namespace Test 10 | { 11 | public static class AppRunner 12 | { 13 | public static CefSharpDriver RunWinFormApp() 14 | => RunApp(@"CefSharpWinFormsTarget\bin\x86\Debug\CefSharpWinFormsTarget.exe"); 15 | 16 | public static CefSharpDriver RunWpfApp() 17 | => RunApp(@"CefSharpWPFTarget\bin\x86\Debug\CefSharpWPFTarget.exe"); 18 | 19 | static CefSharpDriver RunApp(string path) 20 | { 21 | var dir = typeof(AppRunner).Assembly.Location; 22 | for (int i = 0; i < 4; i++) dir = Path.GetDirectoryName(dir); 23 | 24 | var processPath = Path.Combine(dir, path); 25 | var process = Process.Start(processPath); 26 | 27 | //attach by friendly. 28 | var _app = new WindowsAppFriend(process); 29 | var main = _app.WaitForIdentifyFromWindowText("MainWindow"); 30 | 31 | while (!(bool)main.Dynamic().IsLoadEnded) 32 | { 33 | Thread.Sleep(500); 34 | } 35 | 36 | //create driver. 37 | return new CefSharpDriver(main.Dynamic()._browser); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Project/Test/Utility/AssertCompatible.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Test 4 | { 5 | static class AssertCompatible 6 | { 7 | internal static void ThrowsException(Action p) where T : Exception 8 | { 9 | try 10 | { 11 | p(); 12 | } 13 | catch (T) 14 | { 15 | return; 16 | } 17 | throw new Exception(); 18 | } 19 | internal static void ThrowsException(Func p) where T : Exception 20 | { 21 | try 22 | { 23 | p(); 24 | } 25 | catch (T) 26 | { 27 | return; 28 | } 29 | throw new Exception(); 30 | } 31 | 32 | internal static void ThrowsException(Action p, string msg) where T : Exception 33 | { 34 | try 35 | { 36 | p(); 37 | } 38 | catch (T) 39 | { 40 | return; 41 | } 42 | throw new Exception(msg); 43 | } 44 | 45 | internal static void ThrowsException(Func p, string msg) where T : Exception 46 | { 47 | try 48 | { 49 | p(); 50 | } 51 | catch (T) 52 | { 53 | return; 54 | } 55 | throw new Exception(msg); 56 | } 57 | 58 | internal static void IsInstanceOfType(object value, Type type) 59 | { 60 | if (!type.IsAssignableFrom(value.GetType())) 61 | { 62 | throw new Exception(); 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Project/Test/Utility/CompareTestBase.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using OpenQA.Selenium; 3 | using OpenQA.Selenium.Chrome; 4 | using Selenium.CefSharp.Driver; 5 | using System.Diagnostics; 6 | 7 | namespace Test 8 | { 9 | public abstract class CompareTestBase 10 | { 11 | protected interface INeed 12 | { 13 | IWebDriver Driver { get; } 14 | void OneTimeSetUp(); 15 | void OneTimeTearDown(); 16 | } 17 | 18 | INeed _need; 19 | 20 | protected IWebDriver GetDriver() => _need.Driver; 21 | 22 | protected T GetDriver() => (T)GetDriver(); 23 | 24 | protected IJavaScriptExecutor GetExecutor() => (IJavaScriptExecutor)GetDriver(); 25 | 26 | protected CompareTestBase(INeed need) => _need = need; 27 | 28 | [OneTimeSetUp] 29 | public void OneTimeSetUp() => _need.OneTimeSetUp(); 30 | 31 | [OneTimeTearDown] 32 | public void OneTimeTearDown() => _need.OneTimeTearDown(); 33 | 34 | protected class FormsAgent : INeed 35 | { 36 | CefSharpDriver _driver; 37 | 38 | public IWebDriver Driver => _driver; 39 | 40 | public void OneTimeSetUp() 41 | => _driver = AppRunner.RunWinFormApp(); 42 | 43 | public void OneTimeTearDown() 44 | => Process.GetProcessById(_driver.App.ProcessId).Kill(); 45 | } 46 | 47 | protected class WpfAgent : INeed 48 | { 49 | CefSharpDriver _driver; 50 | 51 | public IWebDriver Driver => _driver; 52 | 53 | public void OneTimeSetUp() 54 | => _driver = AppRunner.RunWpfApp(); 55 | 56 | public void OneTimeTearDown() 57 | => Process.GetProcessById(_driver.App.ProcessId).Kill(); 58 | } 59 | 60 | protected class WebAgent : INeed 61 | { 62 | ChromeDriver _driver; 63 | 64 | public IWebDriver Driver => _driver; 65 | 66 | public void OneTimeSetUp() 67 | { 68 | _driver = new ChromeDriver(); 69 | _driver.Url = "https://github.com/Codeer-Software/Selenium.CefSharp.Driver"; 70 | } 71 | 72 | public void OneTimeTearDown() 73 | => _driver.Dispose(); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Project/Test/Utility/HtmlServer.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.IO; 4 | using System.Net; 5 | using System.Net.Sockets; 6 | using System.Text; 7 | 8 | namespace Test 9 | { 10 | [SetUpFixture] 11 | public class HtmlServer 12 | { 13 | internal static HtmlServerCore Instance { get; private set; } 14 | 15 | public HtmlServer() { } 16 | 17 | [OneTimeSetUp] 18 | public void Setup() 19 | { 20 | Instance = HtmlServerCore.StartNew(); 21 | } 22 | 23 | [OneTimeTearDown] 24 | public void TearDown() 25 | { 26 | Instance.Dispose(); 27 | Instance = null; 28 | } 29 | } 30 | 31 | public class HtmlServerCore : IDisposable 32 | { 33 | string _rootDir; 34 | HttpListener listener; 35 | 36 | public string RootUrl { get; } 37 | 38 | HtmlServerCore() 39 | { 40 | var dir = GetType().Assembly.Location; 41 | for (int i = 0; i < 4; i++) dir = Path.GetDirectoryName(dir); 42 | _rootDir = Path.Combine(dir, @"Test\Html"); 43 | RootUrl = GetLocalhostAddress(); 44 | } 45 | 46 | public static HtmlServerCore StartNew() 47 | { 48 | var server = new HtmlServerCore(); 49 | server.Start(); 50 | return server; 51 | } 52 | 53 | public void Close() 54 | { 55 | if (listener != null && listener.IsListening) 56 | { 57 | listener.Abort(); 58 | } 59 | listener = null; 60 | } 61 | 62 | public void Dispose() => Close(); 63 | 64 | void Start() 65 | { 66 | if (listener != null && listener.IsListening) 67 | { 68 | listener.Abort(); 69 | } 70 | 71 | listener = new HttpListener(); 72 | listener.Prefixes.Add(RootUrl); 73 | listener.Start(); 74 | 75 | void callback(IAsyncResult ar) 76 | { 77 | var context = listener.EndGetContext(ar); 78 | listener.BeginGetContext(callback, null); 79 | var request = context.Request; 80 | var response = context.Response; 81 | 82 | var fileName = request.Url.ToString().Replace(RootUrl, string.Empty); 83 | var path = Path.Combine(_rootDir, fileName); 84 | 85 | response.StatusCode = (int)HttpStatusCode.OK; 86 | response.ContentType = "text/html;charset=UTF-8"; 87 | using (var writer = new StreamWriter(response.OutputStream, Encoding.UTF8)) 88 | { 89 | try 90 | { 91 | var html = File.ReadAllText(path); 92 | writer.Write(html); 93 | } 94 | catch { } 95 | } 96 | response.Close(); 97 | } 98 | listener.BeginGetContext(callback, null); 99 | } 100 | 101 | static string GetLocalhostAddress() 102 | { 103 | var listener = new TcpListener(IPAddress.Loopback, 0); 104 | listener.Start(); 105 | int port = ((IPEndPoint)listener.LocalEndpoint).Port; 106 | listener.Stop(); 107 | 108 | return $"http://localhost:{port}/"; 109 | } 110 | } 111 | } -------------------------------------------------------------------------------- /Project/Test/WindowTest.cs: -------------------------------------------------------------------------------- 1 | using OpenQA.Selenium; 2 | using NUnit.Framework; 3 | using OpenQA.Selenium.Support.UI; 4 | using System.Threading; 5 | using SeleniumExtras.WaitHelpers; 6 | 7 | namespace Test 8 | { 9 | //TODO add many window test. 10 | public abstract class WindowTest : CompareTestBase 11 | { 12 | public class Forms : WindowTest 13 | { 14 | public Forms() : base(new FormsAgent()) { } 15 | } 16 | public class Wpf : WindowTest 17 | { 18 | public Wpf() : base(new WpfAgent()) { } 19 | } 20 | public class Web : WindowTest 21 | { 22 | public Web() : base(new WebAgent()) { } 23 | } 24 | protected WindowTest(INeed need) : base(need) { } 25 | 26 | [SetUp] 27 | public void initialize() 28 | { 29 | GetDriver().Url = HtmlServer.Instance.RootUrl + "Window.html"; 30 | } 31 | 32 | [Test] 33 | public void TestWindow() 34 | { 35 | var driver = GetDriver(); 36 | driver.FindElement(By.Id("window")).Click(); 37 | 38 | Thread.Sleep(3000); 39 | 40 | driver.SwitchTo().Window( driver.WindowHandles[1]); 41 | driver.FindElement(By.Id("inputJS")).Click(); 42 | 43 | driver.FindElement(By.Id("alertJS")).Click(); 44 | 45 | var wait = new WebDriverWait(driver, new System.TimeSpan(10000)); 46 | 47 | #pragma warning disable CS0618 48 | var alert = wait.Until(ExpectedConditions.AlertIsPresent()); 49 | #pragma warning restore CS0618 50 | alert.Text.Is("test"); 51 | alert.Accept(); 52 | 53 | driver.FindElement(By.Id("confirmJS")).Click(); 54 | 55 | #pragma warning disable CS0618 56 | var confirm = wait.Until(ExpectedConditions.AlertIsPresent()); 57 | #pragma warning restore CS0618 58 | confirm.Text.Is("test"); 59 | confirm.Dismiss(); 60 | 61 | driver.FindElement(By.Id("promptJS")).Click(); 62 | 63 | #pragma warning disable CS0618 64 | var prompt = wait.Until(ExpectedConditions.AlertIsPresent()); 65 | #pragma warning restore CS0618 66 | prompt.SendKeys("abc"); 67 | prompt.Accept(); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Project/Test/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Project/Test/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Selenium.CefSharp.Driver_β 2 | ====================== 3 | 4 | 5 | The status of this library is beta. 6 | 7 | 8 | ## Features ... 9 | It is a library for operating ChromiumWebBrowser with the interface of Selenium. 10 | Supports WinForms & WPF. 11 | 12 | ## Getting Started 13 | Install Selenium.CefSharp.Driver from NuGet 14 | 15 | PM> Install-Package Selenium.CefSharp.Driver 16 | https://www.nuget.org/packages/Selenium.CefSharp.Driver/ 17 | 18 | ## What problem can this solve? 19 | 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. 20 | This problem will be solved by using CefSharpDriver. 21 | 22 | ## Another process manuplation. 23 | This library is a layer on top of Friendly, so you must learn that first. But it is very easy to learn. 24 | https://github.com/Codeer-Software/Friendly 25 | 26 | ## Sample 27 | https://github.com/Codeer-Software/Selenium.CefSharp.Driver/tree/master/Project/Sample 28 | Sample App. 29 |  30 | 31 | Code. 32 | ```cs 33 | using System.Diagnostics; 34 | using System.IO; 35 | using Codeer.Friendly; 36 | using Codeer.Friendly.Dynamic; 37 | using Codeer.Friendly.Windows; 38 | using Codeer.Friendly.Windows.Grasp; 39 | using Microsoft.VisualStudio.TestTools.UnitTesting; 40 | using OpenQA.Selenium; 41 | using OpenQA.Selenium.Interactions; 42 | using OpenQA.Selenium.Support.UI; 43 | using RM.Friendly.WPFStandardControls; 44 | using Selenium.CefSharp.Driver; 45 | 46 | namespace SampleTest 47 | { 48 | [TestClass] 49 | public class UnitTest 50 | { 51 | WindowsAppFriend _app; 52 | CefSharpDriver _driver; 53 | 54 | [TestInitialize] 55 | public void TestInitialize() 56 | { 57 | //start process. 58 | var process = Process.Start(ProcessPath); 59 | 60 | //attach by friendly. 61 | _app = new WindowsAppFriend(process); 62 | 63 | //show next dialog. 64 | var mainWindow = _app.WaitForIdentifyFromTypeFullName("SampleApp.MainWindow"); 65 | var button = new WPFButtonBase(mainWindow.Dynamic()._buttonNextDialog); 66 | button.EmulateClick(new Async()); 67 | 68 | //get next dialog. 69 | var nextDialog = _app.WaitForIdentifyFromTypeFullName("SampleApp.NextDialog"); 70 | 71 | //create driver. 72 | _driver = new CefSharpDriver(nextDialog.Dynamic()._browser); 73 | } 74 | 75 | [TestCleanup] 76 | public void TestCleanup() 77 | => Process.GetProcessById(_app.ProcessId).Kill(); 78 | 79 | [TestMethod] 80 | public void TestMethod() 81 | { 82 | //set url. 83 | _driver.Url = HtmlPath; 84 | 85 | //find element by id. 86 | var button = _driver.FindElement(By.Id("testButtonClick")); 87 | 88 | //click. 89 | button.Click(); 90 | 91 | //find element by name. 92 | var textBox = _driver.FindElement(By.Name("nameInput")); 93 | 94 | //sendkeys. 95 | textBox.SendKeys("abc"); 96 | 97 | //find element by tag. 98 | var select = _driver.FindElement(By.TagName("select")); 99 | 100 | //selenium support. 101 | new SelectElement(select).SelectByText("Orange"); 102 | 103 | //find element by xpath. 104 | var buttonAlt = _driver.FindElement(By.XPath("//*[@id=\"form\"]/table/tbody/tr[7]/td/input[2]")); 105 | 106 | //actions. 107 | new Actions(_driver).KeyDown(Keys.Alt).Click(buttonAlt).Build().Perform(); 108 | 109 | //execute javascript. 110 | var defaultValue = (string)_driver.ExecuteScript("return arguments[0].defaultValue;", textBox); 111 | } 112 | 113 | static string TestDir 114 | { 115 | get 116 | { 117 | var dir = typeof(UnitTest).Assembly.Location; 118 | for (int i = 0; i < 4; i++) dir = Path.GetDirectoryName(dir); 119 | return dir; 120 | } 121 | } 122 | 123 | static string ProcessPath => Path.Combine(TestDir, @"SampleApp\bin\x86\Debug\SampleApp.exe"); 124 | 125 | static string HtmlPath => Path.Combine(TestDir, "Controls.html"); 126 | } 127 | } 128 | ``` 129 | *** 130 | ## Architecture 131 | I'm not using WebDriver. The function is realized by the combination of the following processes. 132 | 133 | #### Friendly 134 | Call the API of another process. 135 | #### JavaScript 136 | Various processing is realized by JavaScript. 137 | #### Key Mouse Emulate 138 | A low level key mouse emulation. 139 | However, I am adjusting the timing. 140 | 141 | *** 142 | ## Many Doxygen comments are copy from SeleniumHQ 143 | Thank you! 144 | https://github.com/SeleniumHQ/selenium 145 | 146 | --------------------------------------------------------------------------------
126 | 141 |
Shadow root test