Winforms 응용 프로그램 용 셀레늄 드라이버
모든 기여는 환영됩니다 :)
이 프로젝트는 사용 중입니다
다른 드라이버, 이미 https://github.com/microsoft/winappdriver가있는 이유는 무엇입니까? 내가 테스트하고있는 앱은 많은 요소로 상당히 크며, 그 운전자는 일부 XPath 쿼리에서 60 초 후에 타이밍을했으며 (이 문제 참조) 모든 것을 정리 한 후 쿼리는 2 초 미만으로 완료되었습니다.
이 프로젝트는 Windows Accessibility API의 일부인 MS UI 자동화에 의존합니다.
공식 문서는 다양한 플랫폼에 대한 지원을 언급합니다.
UI 자동화는 Windows XP, Windows Server 2003, Windows Server 2003 R2, Windows Vista, Wind
내 컴퓨터에서 10 개의 엔터프라이즈 만 WIN을 받았기 때문에 해당 플랫폼에서 작동한다는 것을 확인할 수는 없지만 필요한 모든 라이브러리는 프로젝트의 일부입니다.
내가 아는 한 개발자 모드는 필요하지 않습니다.
현재 설치 프로그램이 없습니다. 저장소를 복제하고 소스에서 실행 파일을 빌드하십시오. WinAppDriver.ServerbinDebugWinAppDriver.Server.exe 에서 발견 된 실행 파일을 사용하십시오
최신 클라이언트 드라이버 버전 3.141.0.0은 서버를 호출 할 때 사용해야합니다.
Ok . Yes , Semicolon 분리 된 값 목록으로 acceptAlertButtonCaptions 기능을 설정하여 추가 캡션을 추가 할 수 있습니다. Cancel 되었으며 세미콜론 분리 된 값 목록을 사용하여 No dismissAlertButtonCaptions 기능을 설정하여 추가 캡션을 추가 할 수 있습니다. 지원되지 않는 셀레늄 명령
XPath 지원 :
//node[3] //node[@attribute = 'X'] 이 Appium 명령 만 구현됩니다
Selenium.WebDriver v3.141.0 (https://www.nuget.org/packages/selenium.webdriver/3.141.0)에 대한 참조를 추가하면 준비가됩니다.
드라이버는 테스트 프로세스에서 시스템을 시작하거나 실행중인 프로세스에 첨부 할 수 있습니다. 기능을 사용하여 첨부 할 프로세스를 정의하십시오.
명령 줄 인수가 제공되지 않으면 서버는 기본 IP 주소 http://127.0.0.1:4444 에서 시작됩니다.
다음 기능이 지원됩니다.
mode - start (기본값) 또는 attachprocessId 첨부 할 프로세스의 IDprocessName 첨부 할 프로세스의 이름exePath 또는 app 프로세스를 시작하기위한 실행 파일로가는 경로 (현재 인수는 제공 할 수 없습니다)appWorkingDir 새 프로세스의 작업 디렉토리 설정mainWindowTitle winAppdriver가 첨부하는 프로세스를 좁히는 데 도움이되는 정규 표현sendKeyStrategy ( oneByOne | grouped | setValue ) - 텍스트를 텍스트 필드에 입력하는 데 사용하는 전략, 기본값은 oneByOne 입니다. 현재이 기능은 세션 중에 변경할 수 없습니다. public static RemoteWebDriver CreateSessionByStartingTheApplication()
{
DesiredCapabilities desktopCapabilities = new DesiredCapabilities();
desktopCapabilities.SetCapability("app", "<name of the program to start>");
// or "exePath" desktopCapabilities.SetCapability("exePath", "<path to the executable to start the process>");
// following capabilities should be provided for UWP applications like Calculator or Clocks & Alarms
// optional - to set the working directory
desktopCapabilities.SetCapability("appWorkingDir", "<path to run the process in>");
// optional - to identify the process
desktopCapabilities.SetCapability("processName", "<name of the process>");
// optional - to identify the main window
desktopCapabilities.SetCapability("mainWindowTitle", "<name of the process>");
return new RemoteWebDriver(
new CommandExec(new Uri("http://127.0.0.1:4444"),
TimeSpan.FromSeconds(60)),
desktopCapabilities);
}
public static RemoteWebDriver CreateSessionByAttachingToRunningProcess()
{
DesiredCapabilities desktopCapabilities = new DesiredCapabilities();
desktopCapabilities.SetCapability("mode", "attach");
// attach to process using process name
desktopCapabilities.SetCapability("processName", "<name of the process to attach to>");
// with (optional)
desktopCapabilities.SetCapability("windowTitle", "<regular expression to narrow down the list of matching processes>");
// or attach to process using process id
desktopCapabilities.SetCapability("processId", "<id of the process to attach to>");
return new RemoteWebDriver(
new CommandExec(new Uri("http://127.0.0.1:4444"),
TimeSpan.FromSeconds(60)),
desktopCapabilities);
}
권장 요소 위치는 XPath 표현식을 사용하고 있습니다 (표현 지원이 제한되어 있지만)
var webBrowser = session.FindElement(By.XPath("//Pane[@AutomationId='webBrowser']"));
지원되는 요소 위치 메커니즘
TextBox#id 입니다 WIN 애플리케이션의 Windows는 브라우저의 Windows와 다릅니다. Windows ( ControlType.Window )는 Tab 요소와 같은 제어 트리 내부에 중첩 될 수 있습니다.
xpath 표현식 var window = session.FindElement(By.XPath("/Window/Pane/Window[@AutomationId='WindowName']")); 또는 IT session.SwitchTo().Window("WindowName"); , 첫 번째 예에서는 요소 참조를 가져옵니다. 다른 쪽에서는 내부 컨텍스트가 새 창으로 전환되고 다음 작업 중에 캐시 된 요소가 Window가 Cloded session.Close() 처리 할 때 배치 될 수 있습니다.
OpenQA.Selenium.Support.UI.SelectElement 와 같은 요소 랩퍼는 내부적으로 select 하고 option 요소가 예상되므로 작동하지 않습니다.
XPath 표현식을 사용하여 자식 창을 검색 할 때 창을 전환해야 할 필요성을 우회하는 추악한 해킹이 있습니다. 기본적으로 검색은 창의 루트 요소 (사용자가 전환 한 기본 창 또는 창)에서 시작되며 현재 루트의 직접적인 자식이 아니기 때문에 자식 창 검색이 실패했습니다. 수정은 최상위 수준의 창 검색을 시작합니다.