-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to programmatically launch WebView2's Find function. #1737
Comments
Hey @RajeshAKumar - I don't think we currently have a way to do this. Would you like me to add this as a scenario on our backlog? |
This can be done via executing a javascript calling |
Want to highlight "all" the words like how Edge/ Edge control does when we use CTRL + F. |
Yes please log this. |
@RajeshAKumar I've added this as a scenario on our backlog - thanks! |
I tried that and it highlights one time, once we click the page, the highlight goes away. |
Proper support for this would be great please. |
@RajeshAKumar you said:
How can I do this with |
Can you explain this via APIs to understand how to use this? |
@RajeshAKumar ? My screen shot is of CHtmlView which is unrelated to WebView2. |
My issue is to solve this via API in WebView2 in WPF. |
I guess I miss-read your original text. |
FYI, I did just try adding this to a custom context menu:
It doesn't work. Nothing shows on screen. When I used the
Is there any updates on this issue? Thank you. |
Hi @champnic ! I have now managed to use
This works fine: My only request is that the Search bar be improved. The |
FWIW, electron also has this kind of feature |
I'd love to have this feature as well. |
As a workaround, I did it by using the Winform SendKeys class .
then, in my click method, I've first passed the focus to the webview2 (browser) element.
not the most elegant way, perhaps. But it works. |
Can't find a way to close the find UI programmatically. |
@jebihug You could probably send an Escape key to dismiss the UI. |
@champnic This is not working. Especially when the browser don't have the focus and when there is many browsers opened and I want to close the find UI of one of them. |
But we also want the default dialog improved. It is lacking basic find controls.
Sent from Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: mikkelmogensen ***@***.***>
Sent: Sunday, February 11, 2024 6:22:40 PM
To: MicrosoftEdge/WebView2Feedback ***@***.***>
Cc: ajtruckle ***@***.***>; Mention ***@***.***>
Subject: Re: [MicrosoftEdge/WebView2Feedback] How to programmatically launch WebView2's Find function. (#1737)
Also something like
CoreWebView2..SearchStarting event (so default dialog can be overridden)
CoreWebView2.IsDefaultSearchDialogOpenChanged event
CoreWebView2..IsDefaultSearchDialogOpen
CoreWebView2..OpenDefaultSearcDialog()
CoreWebView2..OpenDefaultSearcDialog(string search)
CoreWebView2.CloseDefaultSearchDialog()
would be appreciated
—
Reply to this email directly, view it on GitHub<#1737 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AB45RM2GDUWCIJ7OWANQ2BLYTED7BAVCNFSM5D643UD2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJTG44DEOJZGQ3Q>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I am interested as to how this API is progressing as the suggested ETA was 1-3months and we are at 2months now. 😀 BTW is @nishitha-burman OK as they seemed to go off the radar. 🤗 |
Hi @ajtruckle, from what I can see this item is indeed being picked up and being worked on. Do note that 1 - 3 months was an estimate and not a strong guarantee, as there might be unexpected complications that arises. And thanks for your concern, @nishitha-burman is fine. |
@victorhuangwq So, when will be able to invoke this properly via API? |
@ajtruckle looking at the current API proposal here: https://github.com/MicrosoftEdge/WebView2Feedback/pull/4399/files?short_path=a4e657f#diff-a4e657fb3aef3cc7b9a09b13af805de25931fdb082b2a93aeea46e45de10bb90 It seems like both match case and match whole word should be available options in the API. |
Cool. Do you know when the stable API will be released? |
As you can see, it's still in the works. I'm unable to promise you a timeline. |
@victorhuangwq Any new info about the api release? We are now on the end of august... Would be very nice to have... |
I know they have been beavering away at updating the documentation and adjusting the text from staging to release. So, I guess any time now. 😀 I am interested in the official status too.
Sent from Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: ThHeidenreich ***@***.***>
Sent: Monday, August 26, 2024 12:19:59 PM
To: MicrosoftEdge/WebView2Feedback ***@***.***>
Cc: ajtruckle ***@***.***>; Mention ***@***.***>
Subject: Re: [MicrosoftEdge/WebView2Feedback] How to programmatically launch WebView2's Find function. (#1737)
@victorhuangwq<https://github.com/victorhuangwq> Any new info about the api release? We are now on the end of august... Would be very nice to have...
—
Reply to this email directly, view it on GitHub<#1737 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AB45RM6PDNM2F6IJDQOWRF3ZTMFN7AVCNFSM5D643UD2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMZQHE4TMNJTHEYQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Ohhhh. Today is the anniversary of this question. 3 years. Almost done man ;) |
@zoobesucher Oh yes! 3 years. Wow! |
@champnic any updates on this? |
Ever since the mass layoffs and subsequent AI hype, I feel like there have not been many resources left dedicated to projects like WebView2 by Microsoft. I just wish they would handle it as free and open source software, so that the people who need this functionality implemented could at least do something about it themselves. I faintly remember the WebView2 team stating intentions to open source it a few years ago. |
Would have been great if it was open source and maintained by the community. |
If it went open source, then none of the things are raised would be looked at. Personally, I have no energy these days for additional things beyond my TODO list, let alone the knowledge.
They must have their reasons fo delaying, so I respect that.
…________________________________
From: Niro ***@***.***>
Sent: 14 October 2024 09:33
To: MicrosoftEdge/WebView2Feedback ***@***.***>
Cc: ajtruckle ***@***.***>; Mention ***@***.***>
Subject: Re: [MicrosoftEdge/WebView2Feedback] How to programmatically launch WebView2's Find function. (#1737)
Would have been great if it was open source and maintained by the community.
@champnic<https://github.com/champnic> any way to make that happen?
—
Reply to this email directly, view it on GitHub<#1737 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AB45RM3DPDBI5XJWA2V3J3DZ3N6TZAVCNFSM5D643UD2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TENBRGA2DGNBWGY3A>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hey all - This is still being worked on. It ran into some issues during implementation that we have mostly solved at this point. Right now the estimate is that this will be available as a stable API with the version 132 release SDK, which should ship around mid-January. |
I have a solution my friends!!! I have an application made with For this, I need to download this package:
And this is my method:
If you are using WindowsForms, try using SendKeys:
Works like a charm! |
Hi all! The FindOnPage API is now available as an experimental API in 1.0.3079-prerelease. Using this API, your app can programmatically control Find operations, enabling you to:
Please give it a try and let us know if you have any feedback! |
@maxwellmyers |
It's currently only in prerelease SDK, so you would need to use Edge Canary to test the feature. |
cc @pushkin- |
I have deleted most of my comments and consolidating them into a single comment so that nothing is overlooked. Using Canary RuntimeIn the end I had to modify the user environment variables for my application to pickup the canary runtime. Trying to do it programmatically appeared to have no effect: CHECK_FAILURE(options->put_ReleaseChannels(COREWEBVIEW2_RELEASE_CHANNELS_CANARY));
CHECK_FAILURE(options->put_ChannelSearchKind(COREWEBVIEW2_CHANNEL_SEARCH_KIND_LEAST_STABLE)); WebView2Find API DocumentationThe proposed code snippets caused me issues for two reasons:
InterfacesI had to use the following interfaces:
MacrosThe #define CHECK_FEATURE_RETURN_NULL(feature) { if (!feature) { FeatureNotAvailable(); return nullptr; } } The sample code should be revised. MethodsThe sample code is using a different method for starting the find operation. I have to use: webView2Find->Start The documentation sample should be changed. Completed HandlerFinally, I am unable to use the completed handler, as provided in the sample: Callback<ICoreWebView2ExperimentalFindStartCompletedHandler>(
[this](HRESULT result, BOOL status) -> HRESULT
{
if (SUCCEEDED(result))
{
// Optionally update UI elements here upon successful Find operation.
}
else
{
// Handle errors.
}
return S_OK;
}).Get()) ); I had to replace it with
ObservationsWhen I invoke the Find window (which works) I don't actually "see" the find options): I would like to activate the Find Options toggle so that it is initially visible. |
@champnic @maxwellmyers @pushkin- |
ChatGPT helped me with the completion handler issue and it seems the help documentation needs updating. I had to remove the // Start the Find operation with a callback for completion.
CHECK_FAILURE(webView2Find->Start(
find_options.get(),
Callback<ICoreWebView2ExperimentalFindStartCompletedHandler>(
[this](HRESULT result) -> HRESULT
{
if (SUCCEEDED(result))
{
// Optionally update UI elements here upon successful Find operation.
}
else
{
// Handle errors.
}
return S_OK;
}).Get()) );
// End user interaction is handled via UI. The application now compiles and displays the Find dialog seamlessly—thank you for that! 🙏 However, I still believe it would be a great enhancement to include a toggle feature for the Find Options, allowing users to show or hide them as needed. |
nevermind, looks like I can't instantiate the FindOptions directly and need to use the CreateFindOptions API |
@pushkin- wil::com_ptr<ICoreWebView2ExperimentalFindOptions> find_options;
CHECK_FAILURE(webView2Environment18->CreateFindOptions(&find_options)); Just a pity we can't also toggle the find options to be visible. Would be very useful. |
I have created new tickets for the above feedback. |
We have a HTML page in local WPF app using WebView2, but want to highlight occurrences of a search phrase in the page.
WebView2 does a very nice job of showing this when invoked by user.
We want to leverage this function programmatically.
Can you please guide?
AB#36194641
The text was updated successfully, but these errors were encountered: