Skip to content

Add ClickOptions.OffSet and TapOptions - #61

Merged
amaitland merged 3 commits into
mainfrom
feature/clickoffset
Jun 1, 2025
Merged

Add ClickOptions.OffSet and TapOptions#61
amaitland merged 3 commits into
mainfrom
feature/clickoffset

Conversation

@amaitland

@amaitland amaitland commented May 23, 2025

Copy link
Copy Markdown
Member

Resolves #60
Resolves #62

@SorceryAdmin

Copy link
Copy Markdown

ok this may be a little tricky to explain but I will try.
Having this declarations:

public Dictionary<object, Delegate> UserActions = new Dictionary<object, Delegate>();

then declaring

    protected async Task InitializeDevToolsContext()
    {
         await submitBrowser.InvokeOnUiThreadIfRequired(async () =>
        {
            if (DevToolsContext == null)
                      DevToolsContext = await submitBrowser.CreateDevToolsContextAsync();
        
            
        });   
    }
UserActions.Add("TypeValue", (string querySelector, string value) => this.TypeValue(querySelector, value));
    public async Task TypeValue(string querySelector, string value)
    {
        try
        {
            await InitializeDevToolsContext();
            await submitBrowser.InvokeOnUiThreadIfRequired(async () =>
            {
                await DevToolsContext.QuerySelectorAsync(querySelector);
                await  DevToolsContext.TypeAsync(querySelector,value);
            });
        }
        catch(Exception err) {
                ErrorReporter(err);
           }

    }

then when executed

UserActions["TypeValue"].DynamicInvoke(arguments.ToArray());

QuerySelectorAsync just hangs and never comes back and when it works the exceptions just kill this.

@amaitland amaitland changed the title Add ClickOptions.OffSet Add ClickOptions.OffSet and TapOptions Jun 1, 2025
@amaitland
amaitland marked this pull request as ready for review June 1, 2025 20:42
@amaitland

Copy link
Copy Markdown
Member Author

Tests are passing for the new features, some other failing tests that will be addressed in #59

@amaitland
amaitland merged commit 3a30e8a into main Jun 1, 2025
@amaitland
amaitland deleted the feature/clickoffset branch June 1, 2025 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend TapAsync to support OffSet Add ClickOptions.OffSet

2 participants