How to click into browser embedded into webview2 using selenium+ Springboot

Somwanshi Dnyaneshwar 21 Reputation points
2022-07-14T15:12:08.567+00:00

I am using Springboot+ selenium to automate web application in webview2.
How can i click on element in that embedded browser? 220832-qq.png

Microsoft Edge Microsoft Edge development
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2022-07-15T09:37:31.67+00:00

    Hi @Somwanshi Dnyaneshwar ,

    Based on your description, I created simple example and reproduced your problem. I searched the relevant documentation and I think your needs can not be implemented.

    In the source code, EdgeOptions in C# has the UseWebView property, and related definitions, as mentioned in the comments. Something like this:

       /// <summary>  
               /// Gets or sets whether to create a WebView session used for launching an Edge (Chromium) WebView-based app on desktop.  
               /// </summary>  
               public bool UseWebView  
               {  
                   get { return this.BrowserName == WebViewBrowserNameValue; }  
                   set { this.BrowserName = value ? WebViewBrowserNameValue : DefaultBrowserNameValue; }  
               }  
    

    But EdgeOptions in Java , there is no relevant definition, I also tried the needs you mentioned using C# and it does work fine, so I think this option is a specific implementation in C#. For more details, you could refer to relevant source code :

    EdgeOptions in C#:
    https://github.com/SeleniumHQ/selenium/blob/b00c95823c511ba63d601d80232ada078f3af02b/dotnet/src/webdriver/Edge/EdgeOptions.cs

    EdgeOptions in Java:
    https://github.com/SeleniumHQ/selenium/blob/52845c30e7f514eb6c30a0718a6bacd9c60a0ba0/java/src/org/openqa/selenium/edge/EdgeOptions.java

    With all that said, I think there are only two things you can do:

    1. Switch the WebView2 control to the Edge browser for automation.
    2. Send your suggestions to the relevant team through the github channel.

    Best regards,
    Xudong Peng

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Somwanshi Dnyaneshwar 21 Reputation points
    2022-07-19T07:07:39.437+00:00

    Hi @Anonymous Thanks for your instant response. Your answer helped in me in many ways.
    Thank you again.

    Regards
    Dnyaneshwar Somwanshi

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.