简体   繁体   English

UI 自动化使用 Selenium c# 用于 Windows 应用程序开发使用 Z3055DD731D79EAA7189A62F36724EEF09 应用程序框架

[英]UI Automation using Selenium c# for Windows App developed with WPF application with CEF framework

I am trying to do UI automation for a Windows app made with WPF and CEF(Chromium Embedded Framework).我正在尝试为使用 WPF 和 CEF(Chromium Embedded Framework)制作的 Windows 应用程序进行 UI 自动化。 I couldn't find much stuff online on this topic.我在网上找不到很多关于这个主题的东西。

Note: The App trying to UI test is already running on windows 10 and it can be found minimized with the tray icons.注意:尝试 UI 测试的应用程序已经在 windows 10 上运行,并且可以通过托盘图标找到最小化。

What I am trying to accomplish is to 1. Open the app 2. Search for elements in the app.我想要完成的是 1. 打开应用程序 2. 在应用程序中搜索元素。 This is the code snippet i have written to open the app.这是我为打开应用程序而编写的代码片段。

[TestMethod]
    public void TestMethod1()
    {

        ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.BinaryLocation = "C:\\Program Files (x86)\\App\\AppClient.exe";

        System.Environment.SetEnvironmentVariable("webdriver.chrome.driver", @"C:\Users\source\repos\bin\Debug\chromedriver.exe");

      IWebDriver webDriver = new ChromeDriver(chromeOptions);
    }

When I run this I get the error当我运行它时,我得到了错误

Message: Test method WebViewPoc.UnitTest1.TestMethod1 threw exception: OpenQA.Selenium.WebDriverException: unknown error: Chrome failed to start: exited normally.消息:测试方法 WebViewPoc.UnitTest1.TestMethod1 抛出异常:OpenQA.Selenium.WebDriverException:未知错误:Chrome 无法启动:正常退出。 (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location C:\Program Files (x86)\App\AppClient.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.) Stack Trace: RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) RemoteWebDriver.ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) ChromeDriver.ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout) ChromeDriver.ctor(ChromeOptions options) UnitTest1.TestMethod1() line 25 (未知错误:DevToolsActivePort 文件不存在)(进程从 chrome 位置 C:\Program Files (x86)\App\AppClient.exe 不再运行,因此 ChromeDriver 假设 Chrome 已崩溃。)堆栈跟踪: RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 参数) RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) RemoteWebDriver.ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) ChromeDriver.ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout) ChromeDriver .ctor(ChromeOptions 选项) UnitTest1.TestMethod1() 第 25 行

Note: I have edited some of the dir location and names.注意:我已经编辑了一些目录位置和名称。

Will be great if someone could help with this and if someone has automated this kind of application before will be great to get some code for this.如果有人可以帮助解决这个问题,并且如果有人之前已经自动化了这种应用程序,将会很好地获得一些代码。

[TestMethod]
    public void TestMethod1()
    {

      ChromeOptions chromeOptions = new ChromeOptions();
      chromeOptions.BinaryLocation = "C:\\Program Files (x86)\\App\\AppClient.exe";

      chromeOptions.AddArguments("remote-debugging-port=port#");

      var driver = new ChromeDriver(chromeOptions);
    }

port# is debugging port number of the app you are trying to test, ask the developer for this. port#是您要测试的应用程序的调试端口号,请向开发人员询问。 Ask the developer if you have to add a registry key as well.询问开发人员是否还必须添加注册表项。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在monomac和xcode中开发的C#应用​​程序不能在具有单一框架的Windows上执行 - C# application developed in monomac & xcode not executing on windows with mono framework 如何在“ Windows身份验证对话框”上应用自动化并使用c#,Selenium Webdriver登录到Web应用程序 - How to apply automation on “Windows authentication dialog” and login into the web application using c# , selenium webdriver 是否可以在不更改现有代码的情况下在已经开发的C#Windows窗体应用程序中实现WPF? - Is it possible to implement WPF in already developed C# Windows form application Without Changing Existing code? Selenium Webdriver C#-无法在使用角度UI开发的网格中找到元素 - Selenium webdriver C# - Unable to find the element in a grid developed using angular UI 使用C#使用Winium进行桌面Windows应用程序自动化 - Desktop Windows Application automation using winium using c# C#WPF应用程序在已开发的计算机上运行,​​但在其他任何地方都无法运行 - C# WPF Application runs on the developed Computer but not any where else 如何使用Windows应用程序驱动程序在UI自动化单元测试期间验证WPF复选框的状态? - How can I verify the state of a WPF checkbox during a UI Automation Unit Test using the Windows Application Driver? 在Visual Studio中使用Selenium C#进行Web自动化测试与使用C#进行桌面应用自动化测试有何相似之处? - How similar is Web Automation testing using Selenium C# in Visual Studio to Desktop App Automation Testing using C#? 如何在 C# 中使用 Selenium 在 UI 自动化中处理身份验证弹出窗口 - How to handle authentication popup window in UI automation using Selenium in C# 用 C# 开发的 Windows 服务应用程序的用例图 - Use case diagram for a Windows service application developed in C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM