Giter VIP home page Giter VIP logo

flaui.webdriver's Introduction

FlaUI.WebDriver

build

FlaUI.WebDriver is a W3C WebDriver2 implementation using FlaUI's automation. It currently only supports UIA3.

Important

This WebDriver implementation is EXPERIMENTAL. It is not feature complete and may not implement all features correctly.

Motivation

Capabilities

The following capabilities are supported:

Capability Name Description Example value
platformName Must be set to windows (case-insensitive). windows
appium:automationName Must be set to FlaUI (case-insensitive). FlaUI
appium:app The path to the application, or in case of an UWP app, <package family name>!App. It is also possible to set app to Root. In such case the session will be invoked without any explicit target application. Either this capability, appTopLevelWindow or appTopLevelWindowTitleMatch must be provided on session startup. C:\Windows\System32\notepad.exe, Microsoft.WindowsCalculator_8wekyb3d8bbwe!App
appium:appArguments Application arguments string, for example /?.
appium:appWorkingDir Full path to the folder, which is going to be set as the working dir for the application under test. This is only applicable for classic apps. When this is used the appium:app may contain a relative file path. C:\MyApp\
appium:appTopLevelWindow The hexadecimal handle of an existing application top level window to attach to, for example 0x12345 (should be of string type). Either this capability, appTopLevelWindowTitleMatch or app must be provided on session startup. 0xC0B46
appium:appTopLevelWindowTitleMatch The title of an existing application top level window to attach to, for example My App Window Title (should be of string type). Either this capability, appTopLevelWindow or app must be provided on session startup. My App Window Title or My App Window Title - .*
appium:newCommandTimeout The number of seconds the to wait for clients to send commands before deciding that the client has gone away and the session should shut down. Default one minute (60). 120

Getting Started

This driver currenlty can be downloaded as an executable. Start the web driver service with:

./FlaUI.WebDriver.exe --urls=http://localhost:4723/

After it has started, it can be used via WebDriver clients such as for example:

Using the Selenium.WebDriver C# client:

using OpenQA.Selenium;

public class FlaUIDriverOptions : DriverOptions
{
    public static FlaUIDriverOptions App(string path)
    {
        var options = new FlaUIDriverOptions()
        {
            PlatformName = "windows"
        };
        options.AddAdditionalOption("appium:automationName", "flaui");
        options.AddAdditionalOption("appium:app", path);
        return options;
    }

    public override ICapabilities ToCapabilities()
    {
        return GenerateDesiredCapabilities(true);
    }
}

var driver = new RemoteWebDriver(new Uri("http://localhost:4723"), FlaUIDriverOptions.App("C:\\YourApp.exe"))

Using the WebdriverIO JavaScript client:

import { remote } from 'webdriverio'

const driver = await remote({
    capabilities: {
        platformName: 'windows',
        'appium:automationName': 'flaui'
        'appium:app': 'C:\\YourApp.exe'
    }
});

Selectors

On Windows, the recommended selectors, in order of reliability are:

Selector Locator strategy keyword Supported?
Automation ID "accessibility id"
Name "name"
Class name "class name"
Link text selector "link text"
Partial link text selector "partial link text"
Tag name "tag name"
XPath selector "xpath"
CSS selector "css selector" Only ID, class or name attribute selectors. IDs are interpreted as automation IDs.

Using the Selenium C# client, the selectors are:

driver.FindElement(By.Id("TextBox")).Click(); // Matches by automation ID
driver.FindElement(By.Name("TextBox")).Click();
driver.FindElement(By.ClassName("TextBox")).Click();
driver.FindElement(By.LinkText("Button")).Click();
driver.FindElement(By.PartialLinkText("Button")).Click();
driver.FindElement(By.TagName("RadioButton")).Click();
driver.FindElement(By.XPath("//RadioButton")).Click();

Using the WebdriverIO JavaScript client (see WebdriverIO Selectors guide:

await driver.$('~automationId').click();
await driver.$('[name="Name"]').click();
await driver.$('.TextBox').click();
await driver.$('=Button').click();
await driver.$('*=Button').click();
await driver.$('<RadioButton />').click();
await driver.$('//RadioButton').click();

Windows

The driver supports switching windows. The behavior of windows is as following (identical to behavior of e.g. the Chrome driver):

  • By default, the window is the window that the application was started with.
  • The window does not change if the app/user opens another window, also not if that window happens to be on the foreground.
  • All open window handles from the same app process (same process ID in Windows) can be retrieved.
  • Other processes spawned by the app that open windows are not visible as window handles. Those can be automated by starting a new driver session with e.g. the appium:appTopLevelWindow capability.
  • Closing a window does not automatically switch the window handle. That means that after closing a window, most commands will return an error "no such window" until the window is switched.
  • Switching to a window will set that window in the foreground.

Running scripts

The driver supports PowerShell commands.

Using the Selenium C# client:

var result = driver.ExecuteScript("powerShell", new Dictionary<string,string> { ["command"] = "1+1" });

Using the WebdriverIO JavaScript client:

const result = driver.executeScript("powerShell", [{ command: `1+1` }]);

Supported WebDriver Commands

Method URI Template Command Implemented
POST /session New Session
DELETE /session/{session id} Delete Session
GET /status Status
GET /session/{session id}/timeouts Get Timeouts
POST /session/{session id}/timeouts Set Timeouts
POST /session/{session id}/url Navigate To N/A
GET /session/{session id}/url Get Current URL N/A
POST /session/{session id}/back Back N/A
POST /session/{session id}/forward Forward N/A
POST /session/{session id}/refresh Refresh N/A
GET /session/{session id}/title Get Title
GET /session/{session id}/window Get Window Handle
DELETE /session/{session id}/window Close Window
POST /session/{session id}/window Switch To Window
GET /session/{session id}/window/handles Get Window Handles
POST /session/{session id}/window/new New Window
POST /session/{session id}/frame Switch To Frame N/A
POST /session/{session id}/frame/parent Switch To Parent Frame N/A
GET /session/{session id}/window/rect Get Window Rect
POST /session/{session id}/window/rect Set Window Rect
POST /session/{session id}/window/maximize Maximize Window
POST /session/{session id}/window/minimize Minimize Window
POST /session/{session id}/window/fullscreen Fullscreen Window
GET /session/{session id}/element/active Get Active Element
GET /session/{session id}/element/{element id}/shadow Get Element Shadow Root N/A
POST /session/{session id}/element Find Element
POST /session/{session id}/elements Find Elements
POST /session/{session id}/element/{element id}/element Find Element From Element
POST /session/{session id}/element/{element id}/elements Find Elements From Element
POST /session/{session id}/shadow/{shadow id}/element Find Element From Shadow Root N/A
POST /session/{session id}/shadow/{shadow id}/elements Find Elements From Shadow Root N/A
GET /session/{session id}/element/{element id}/selected Is Element Selected
GET /session/{session id}/element/{element id}/attribute/{name} Get Element Attribute 1
GET /session/{session id}/element/{element id}/property/{name} Get Element Property
GET /session/{session id}/element/{element id}/css/{property name} Get Element CSS Value N/A
GET /session/{session id}/element/{element id}/text Get Element Text
GET /session/{session id}/element/{element id}/name Get Element Tag Name
GET /session/{session id}/element/{element id}/rect Get Element Rect
GET /session/{session id}/element/{element id}/enabled Is Element Enabled
GET /session/{session id}/element/{element id}/computedrole Get Computed Role
GET /session/{session id}/element/{element id}/computedlabel Get Computed Label
POST /session/{session id}/element/{element id}/click Element Click
POST /session/{session id}/element/{element id}/clear Element Clear
POST /session/{session id}/element/{element id}/value Element Send Keys
GET /session/{session id}/source Get Page Source N/A
POST /session/{session id}/execute/sync Execute Script
POST /session/{session id}/execute/async Execute Async Script
GET /session/{session id}/cookie Get All Cookies N/A
GET /session/{session id}/cookie/{name} Get Named Cookie N/A
POST /session/{session id}/cookie Add Cookie N/A
DELETE /session/{session id}/cookie/{name} Delete Cookie N/A
DELETE /session/{session id}/cookie Delete All Cookies N/A
POST /session/{session id}/actions Perform Actions
DELETE /session/{session id}/actions Release Actions
POST /session/{session id}/alert/dismiss Dismiss Alert
POST /session/{session id}/alert/accept Accept Alert
GET /session/{session id}/alert/text Get Alert Text
POST /session/{session id}/alert/text Send Alert Text
GET /session/{session id}/screenshot Take Screenshot
GET /session/{session id}/element/{element id}/screenshot Take Element Screenshot
POST /session/{session id}/print Print Page

WebDriver Interpretation

There is an interpretation to use the WebDriver specification to drive native automation. Appium does not seem to describe that interpretation and leaves it up to the implementer as well. Therefore we describe it here:

WebDriver term Interpretation
browser The Windows OS on which the FlaUI.WebDriver instance is running
top-level browsing contexts Any window of the app under test (modal windows too)
current top-level browsing context The current selected window of the app under test
browsing contexts Any window of the app under test (equal to "top-level browsing contexts")
current browsing context The current selected window of the app under test (equal to "current top-level browsing context")
window Any window of the app under test (modal windows too)
frame Not implemented - frames are only relevant for web browsers
shadow root Not implemented - shadow DOM is only relevant for web browsers
cookie Not implemented - cookies are only relevant for web browsers
tag name Control type in Windows
attribute UI automation element property in Windows

Deviations from W3C WebDriver Spec

https://www.w3.org/TR/webdriver2/#element-send-keys says:

Set the text insertion caret using set selection range using current text length for both the start and end parameters.

This is impossible using UIA, as there is no API to set the caret position: text instead gets inserted at the beginning of a text box. This is also WinAppDriver's behavior.

Element Attributes

Attributes are mapped to UI automation element properties. Attributes without a period (.) are mapped to Automation Element Properties. For example to read the UIA_ClassNamePropertyId using Selenium WebDriver:

var element = driver.FindElement(By.Id("TextBox"));
var value = element.GetDomAttribute("ClassName");

Attributes with a period are treated as Control Pattern Properties with the form Pattern.Property. For example to read the UIA_ToggleToggleStatePropertyId using Selenium WebDriver:

var element = driver.FindElement(By.Id("ToggleButton"));
var value = element.GetDomAttribute("Toggle.ToggleState");

Next Steps

Possible next steps for this project:

Footnotes

  1. In Selenium WebDriver, use GetDomAttribute because GetAttribute converts to javascript.

flaui.webdriver's People

Contributors

aristotelos avatar dependabot[bot] avatar dor-bl avatar grokys avatar roemer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flaui.webdriver's Issues

Selector strategy 'xpath' is not supported

When running the following python code against both WinAppDriver and FlaUI.WebDriver I get an error from FlaUI.WebDriver:

from selenium import webdriver # using selenium 3.141.0

app = "notepad.exe"

capabilities = {
    "app": app,
    "appium:app": app,
    "platformName": "Windows",
}
session = webdriver.Remote(
    command_executor="http://127.0.0.1:4723", desired_capabilities=capabilities
)
session.find_element_by_class_name("Edit").send_keys("class_name\n")
session.find_element_by_xpath("//Edit").send_keys("xpath\n")

WinAppDriver

==========================================
POST /session/1FEE2949-B25E-48CB-B24E-358E126917F4/element HTTP/1.1
Accept: application/json
Accept-Encoding: identity
Content-Length: 90
Content-Type: application/json;charset=UTF-8
Host: 127.0.0.1:4723
User-Agent: selenium/3.141.0 (python windows)

{"using": "xpath", "value": "//Edit", "sessionId": "1FEE2949-B25E-48CB-B24E-358E126917F4"}
HTTP/1.1 200 OK
Content-Length: 96
Content-Type: application/json

{"sessionId":"1FEE2949-B25E-48CB-B24E-358E126917F4","status":0,"value":{"ELEMENT":"42.4329744"}}

FlaUI.WebDriver

info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3]
      Route matched with {action = "FindElement", controller = "FindElements"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult] FindElement(System.String, FlaUI.WebDriver.Models.FindElementRequest) on controller FlaUI.WebDriver.Controllers.FindElementsController (FlaUI.WebDriver).
fail: FlaUI.WebDriver.WebDriverResponseExceptionFilter[0]
      Returning WebDriver error response with error code unsupported operation
      FlaUI.WebDriver.WebDriverResponseException: Selector strategy 'xpath' is not supported
         at FlaUI.WebDriver.Controllers.FindElementsController.GetCondition(ConditionFactory conditionFactory, String using, String value)
         at FlaUI.WebDriver.Controllers.FindElementsController.FindElementFrom(Func`1 startNode, FindElementRequest findElementRequest, Session session)
         at FlaUI.WebDriver.Controllers.FindElementsController.FindElement(String sessionId, FindElementRequest findElementRequest)
         at lambda_method12(Closure , Object )
         at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

Appium: Providing .App throw's an error.

Using Appium Dotntet client V5 RC

The below works for Microsoft/WinAppDriver
Error:

OpenQA.Selenium.WebDriverArgumentException: 'Starting app 'Microsoft.WindowsCalculator_8wekyb3d8bbwe!App' with arguments '' threw an exception: An error occurred trying to start process 'Microsoft.WindowsCalculator_8wekyb3d8bbwe!App' with working directory '.'. The system cannot find the file specified.'

Steps to repro:

    private WindowsDriver _calculatorSession;
    protected static WebElement CalculatorResult;
    private string _appId = "Microsoft.WindowsCalculator_8wekyb3d8bbwe!App";

    [OneTimeSetUp]
    public void BeforeAll()
    {
        var appCapabilities = new AppiumOptions();
        appCapabilities.AutomationName = "Windows";
        appCapabilities.App = _appId;
        appCapabilities.DeviceName = "WindowsPC";
        appCapabilities.PlatformName = "Windows";

        var serverUri = Env.ServerIsRemote() ? AppiumServers.RemoteServerUri : AppiumServers.LocalServiceUri;
        _calculatorSession = new WindowsDriver(serverUri, appCapabilities,
            Env.InitTimeoutSec);
        _calculatorSession.Manage().Timeouts().ImplicitWait = Env.ImplicitTimeoutSec;

        _calculatorSession.FindElement(MobileBy.Name("Clear")).Click();
        _calculatorSession.FindElement(MobileBy.Name("Seven")).Click();
        CalculatorResult = _calculatorSession.FindElement(MobileBy.Name("Display is 7"));
        Assert.That(CalculatorResult, Is.Not.Null);
    }

Duplicate input sources being added.

When running tests, I'm seeing various instances of the follow error occur:

OpenQA.Selenium.WebDriverException : The actions command returned an unexpected error. System.ArgumentException: An item with the same key has already been added. Key: default keyboard
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at FlaUI.WebDriver.InputState.AddInputSource(String inputId, InputSource inputSource) in D:\projects\FlaUI\FlaUI.WebDriver\src\FlaUI.WebDriver\InputState.cs:line 98
   at FlaUI.WebDriver.Controllers.ActionsController.ExtractActionSequence(Session session, ActionsRequest actionsRequest) in D:\projects\FlaUI\FlaUI.WebDriver\src\FlaUI.WebDriver\Controllers\ActionsController.cs:line 79
   at FlaUI.WebDriver.Controllers.ActionsController.PerformActions(String sessionId, ActionsRequest actionsRequest) in D:\projects\FlaUI\FlaUI.WebDriver\src\FlaUI.WebDriver\Controllers\ActionsController.cs:line 28
   at lambda_method69(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Looks like input sources aren't being cleaned up properly in some instances. Will investigate, as I added this code 🤔

COMException in UIA3Automation.Compare and performance problems with long-running sessions.

I'm seeing this exception quite a lot:

System.Runtime.InteropServices.COMException
  HResult=0x80004005
  Message=Error HRESULT E_FAIL has been returned from a call to a COM component.
  Source=<Cannot evaluate the exception source>
  StackTrace:
 	FlaUI.UIA3.dll!FlaUI.UIA3.UIA3Automation.Compare(FlaUI.Core.AutomationElements.AutomationElement element1, FlaUI.Core.AutomationElements.AutomationElement element2)	Unknown
 	FlaUI.Core.dll!FlaUI.Core.AutomationElements.AutomationElement.Equals(FlaUI.Core.AutomationElements.AutomationElement other)	Unknown
>	FlaUI.WebDriver.dll!FlaUI.WebDriver.Session.GetOrAddKnownElement.AnonymousMethod__0(FlaUI.WebDriver.KnownElement knownElement) Line 80	C#
 	System.Linq.dll!System.Linq.Enumerable.TryGetFirst<FlaUI.WebDriver.KnownElement>(System.Collections.Generic.IEnumerable<FlaUI.WebDriver.KnownElement> source, System.Func<FlaUI.WebDriver.KnownElement, bool> predicate, out bool found)	Unknown
 	System.Linq.dll!System.Linq.Enumerable.FirstOrDefault<FlaUI.WebDriver.KnownElement>(System.Collections.Generic.IEnumerable<FlaUI.WebDriver.KnownElement> source, System.Func<FlaUI.WebDriver.KnownElement, bool> predicate)	Unknown
 	FlaUI.WebDriver.dll!FlaUI.WebDriver.Session.GetOrAddKnownElement(FlaUI.Core.AutomationElements.AutomationElement element) Line 80	C#
 	System.Linq.dll!System.Linq.Utilities.CombineSelectors.AnonymousMethod__0(System.__Canon x)	Unknown
 	System.Linq.dll!System.Linq.Enumerable.SelectArrayIterator<FlaUI.Core.AutomationElements.AutomationElement, FlaUI.WebDriver.Models.FindElementResponse>.ToArray()	Unknown
 	System.Linq.dll!System.Linq.Enumerable.ToArray<FlaUI.WebDriver.Models.FindElementResponse>(System.Collections.Generic.IEnumerable<FlaUI.WebDriver.Models.FindElementResponse> source)	Unknown
 	FlaUI.WebDriver.dll!FlaUI.WebDriver.Controllers.FindElementsController.FindElementsFrom(System.Func<FlaUI.Core.AutomationElements.AutomationElement> startNode, FlaUI.WebDriver.Models.FindElementRequest findElementRequest, FlaUI.WebDriver.Session session) Line 92	C#
 	FlaUI.WebDriver.dll!FlaUI.WebDriver.Controllers.FindElementsController.FindElements(string sessionId, FlaUI.WebDriver.Models.FindElementRequest findElementRequest) Line 42	C#

Not sure why COMException would be thrown by UIA3Automation.Compare.

Collection was modified; enumeration operation may not execute

When running tests, after #41 I've started seeing the following exception:

System.InvalidOperationException
  HResult=0x80131509
  Message=Collection was modified; enumeration operation may not execute.
  Source=System.Private.CoreLib
  StackTrace:
   at System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion()
   at System.Collections.Generic.Dictionary`2.Enumerator.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.ToArray()
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at FlaUI.WebDriver.Session.EvictUnavailableElements() in D:\projects\FlaUI\FlaUI.WebDriver\src\FlaUI.WebDriver\Session.cs:line 133
   at FlaUI.WebDriver.SessionCleanupService.EvictUnavailableElements(ISessionRepository sessionRepository) in D:\projects\FlaUI\FlaUI.WebDriver\src\FlaUI.WebDriver\SessionCleanupService.cs:line 47
   at FlaUI.WebDriver.SessionCleanupService.DoWork(Object state) in D:\projects\FlaUI\FlaUI.WebDriver\src\FlaUI.WebDriver\SessionCleanupService.cs:line 39
   at System.Threading.TimerQueueTimer.<>c.<.cctor>b__27_0(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

Looks like firing the cleanup on a timer is causing a problem whereby a query is running at the same time, which is adding an item to the dictionary.

[Feat request] Support UseShellExecute & isAppOwnedBySession false

This may need to be split in two if these settings are intended to be independently used.

I have an application which had a 'two-stage' start process.

When I use standard FlaUI C# (non-WebDriver) I needed to use

  • processStartInfo.UseShellExecute = true;
  • separate out Launch from Attach

e.g.

var processStartInfo = new ProcessStartInfo("initialstart.application");
processStartInfo.UseShellExecute = true; 

using (Application.Launch(processStartInfo))
{
   Thread.Sleep(10000);	//wait for actual application to start
   using (var app = Application.Attach("actualapplication.exe"))
     {

These are not currently supported by WebDriver. For now, I have locally modified FlaUI.WebDriver SessionController.cs as

processStartInfo.UseShellExecute = true;        //new line added here
app = Core.Application.Launch(processStartInfo);

and
isAppOwnedBySession = false;

Automate desktop

We're using WinAppDriver atm and if you provide "Root" as app you can find the Taskbar and interact with the icons there. Is that not possible with FlaUI.WebDriver?

Element Send Keys does not follow spec.

It simply sets TetxBox text, which is obviously incorrect according to https://www.w3.org/TR/webdriver2/#element-send-keys:

https://github.com/FlaUI/FlaUI.WebDriver/blob/main/src/FlaUI.WebDriver/Controllers/ElementController.cs#L182

I have started work on this but the process outlined by the spec requires a number of things that are currently not implemented, such as input sources. Not sure how closely the spec should be followed, or whether an initial "good enough for now" PR would be accepted.

[Bug] An element is off-screen when two or more windows are opened after an application launch

Hi guys! I faced a problem while was trying to interect with an element

Pre-conditions

I have an app that launches 2 windows after its start (the second one is not actually a window because the window_handle is the same so it is like a part of the main window). Here is an example:
image

The "Select patient" window appears after the main window immediately.

Steps to reproduce from my side

  1. I'm filling in the patient's data and pressing OK
  2. The second window closes automatically (the window_handle is the same as well as the current_window_handle)
  3. I'm trying to interact with any element on the main form
  4. Facing the error below:
    response = {'status': 400, 'value': '{"value":{"error":"element not interactable","message":"Element with ID 2f7955c3-640c-4f2c-ab35-c477c122de49 is off screen","stackTrace":""}}'}

I also noticed that all elements have x:0, y:0 position, but they are enabled (checked with is_enabled method)

What can I do to fix the error above? Thank you! Please feel free to ask any details

Add.Info

I used to use WinAppDriver and everything worked correctly there. The needed element had a correct position

Supported Capabilities

Description

In WindowsDriver there are capabilities, such as "waitForAppLaunch", "newCommandTimeout", that as per documentation are not supported by FlaUI.WebDriver. in particular "newCommandTimeout" would be important when dealing with several drivers running.

Environment

.NET 6 with C#
Appium server version 2.5.1
dotnet-client: Appium.WebDriver 5.0.0-rc.6
Selenium.WebDriver 4.18.1
appium-windows-driver
OS Windows 11
npm 10.5.0
Windows Application

Thank you

DeviceName capability throws an exception

When including DeviceName in the Appium Options, I receive the below error:

System.InvalidOperationException : Required capabilities did not match. Capability `platformName` with value `windows` is required, capability 'appium:automationName' with value `FlaUI` is required, and one of appium:app, appium:appTopLevelWindow or appium:appTopLevelWindowTitleMatch must be passed as a capability (SessionNotCreated)

Code to repro:

                    AppiumOptions desktopCapabilities = new AppiumOptions();
                    desktopCapabilities.App = "Root";
                    desktopCapabilities.DeviceName = "WindowsPC";
                    desktopCapabilities.AutomationName = "FlaUI";
                    var desktopSession = new WindowsDriver(serverUri, desktopCapabilities);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.