Exemplo n.º 1
0
        /// <inheritdoc cref="IFrame.TripleClickAsync(string, ClickOptions)"/>
        public async Task TripleClickAsync(string selector, ClickOptions options = null)
        {
            var handle = await OptionallyWaitForSelectorInUtilityContextAsync(selector, options).ConfigureAwait(false);

            await handle.TripleClickAsync(options).ConfigureAwait(false);

            await handle.DisposeAsync().ConfigureAwait(false);
        }
Exemplo n.º 2
0
        private async Task PerformPointerActionAsync(Func <Point, Task> action, ClickOptions options)
        {
            var point = await EnsurePointerActionPointAsync(options?.RelativePoint).ConfigureAwait(false);

            Modifier[] restoreModifiers = null;

            if (options?.Modifiers != null)
            {
                restoreModifiers = await _page.Keyboard.EnsureModifiersAsync(options.Modifiers).ConfigureAwait(false);
            }

            await action(point).ConfigureAwait(false);

            if (restoreModifiers != null)
            {
                await _page.Keyboard.EnsureModifiersAsync(restoreModifiers).ConfigureAwait(false);
            }
        }
Exemplo n.º 3
0
 /// <inheritdoc />
 public Task TripleClickAsync(string selector, ClickOptions options = null) => throw new NotImplementedException();
Exemplo n.º 4
0
        private async Task <IElementHandle> OptionallyWaitForSelectorInUtilityContextAsync(string selector, ClickOptions options)
        {
            options ??= new ClickOptions();
            options.Timeout ??= Page.DefaultTimeout;

            IElementHandle handle;

            if (options.WaitFor != WaitForOption.NoWait)
            {
                var maybeHandle = await WaitForSelectorInUtilityContextAsync(selector, options.WaitFor, options.Timeout).ConfigureAwait(false);

                if (maybeHandle == null)
                {
                    throw new PlaywrightSharpException($"No node found for selector: {SelectorToString(selector, options.WaitFor)}");
                }

                handle = maybeHandle;
            }
            else
            {
                var context = await GetContextAsync(ContextType.Utility).ConfigureAwait(false);

                var maybeHandle = await context.QuerySelectorAsync(selector).ConfigureAwait(false);

                if (maybeHandle == null)
                {
                    throw new PlaywrightSharpException($"No node found for selector: {selector}");
                }

                handle = maybeHandle !;
            }

            return(handle);
        }
Exemplo n.º 5
0
 /// <inheritdoc cref="IElementHandle.TripleClickAsync(ClickOptions)"/>
 public Task TripleClickAsync(ClickOptions options = null) => PerformPointerActionAsync(point => Page.Mouse.TripleClickAsync(point.X, point.Y, options), options);
Exemplo n.º 6
0
 /// <inheritdoc cref="IPage.ClickAsync(string, ClickOptions)"/>
 public Task ClickAsync(string selector, ClickOptions options = null) => MainFrame.ClickAsync(selector, options);
 /// <inheritdoc />
 public Task TripleClickAsync(ClickOptions options = null) => throw new NotImplementedException();