Exemplo n.º 1
0
        public async Task SetInputFilesAsync(IEnumerable <string> files, ElementHandleSetInputFilesOptions options = default)
        {
            var frame = await OwnerFrameAsync().ConfigureAwait(false);

            if (frame == null)
            {
                throw new PlaywrightException("Cannot set input files to detached element.");
            }
            var converted = await SetInputFilesHelpers.ConvertInputFilesAsync(files, (BrowserContext)frame.Page.Context).ConfigureAwait(false);

            if (converted.Files != null)
            {
                await _channel.SetInputFilesAsync(converted.Files, options?.NoWaitAfter, options?.Timeout).ConfigureAwait(false);
            }
            else
            {
                await _channel.SetInputFilePathsAsync(converted?.LocalPaths, converted?.Streams, options?.NoWaitAfter, options?.Timeout).ConfigureAwait(false);
            }
        }
Exemplo n.º 2
0
 public async Task SetInputFilesAsync(IEnumerable <FilePayload> files, ElementHandleSetInputFilesOptions options = default)
 {
     var converted = SetInputFilesHelpers.ConvertInputFiles(files);
     await _channel.SetInputFilesAsync(converted.Files, options?.NoWaitAfter, options?.Timeout).ConfigureAwait(false);
 }