Molybden API
Loading...
Searching...
No Matches
molybden::TextFinder Class Referenceabstract

Allows finding text on the loaded web page. More...

#include <text_finder.hpp>

Public Types

using FindResultCallback = std::function< void(const FindResult &)>
 

Public Member Functions

virtual std::shared_ptr< Browserbrowser ()=0
 Returns the browser instance of this text finder.
 
virtual void find (const std::string &text, FindResultCallback callback)=0
 Performs search of the given text, highlights all matches and selects the first match on the currently loaded web page.
 
virtual void find (const std::string &text, const FindOptions &options, FindResultCallback callback)=0
 Performs search of the given text with the given options, highlights all matches and selects the first or the last (depending on the given FindOptions::is_search_backward flag) match on the currently loaded web page.
 
virtual void stopFindingAndKeepSelection ()=0
 Stops finding and keeps the currently highlighted match selected.
 
virtual void stopFindingAndClearSelection ()=0
 Stops finding and clears the highlighting of the found matches.
 

Detailed Description

Allows finding text on the loaded web page.

Member Function Documentation

◆ find() [1/2]

virtual void molybden::TextFinder::find ( const std::string &  text,
const FindOptions options,
FindResultCallback  callback 
)
pure virtual

Performs search of the given text with the given options, highlights all matches and selects the first or the last (depending on the given FindOptions::is_search_backward flag) match on the currently loaded web page.

Subsequent calls of this method with the same text select the next or the previous match depending on the given FindOptions::is_search_backward flag.

If this method is invoked after stopFindingAndKeepSelection() then the search will start from the last selected match, and if after stopFindingAndClearSelection() then the search will start from the first or the last (depending on the given FindOptions::is_search_backward flag) match.

If the search is still in progress, but the page content is already changed, then the search result will be displayed for the new content of the page (different number of matches, and the next or the previous selected match).

The search is performed only through a visible content on the loaded web page. If some text is presented on the web page, but due to CSS rules it is not visible, the text finder will not check this content during search. Also, it does not find text on the web pages with an empty size, so make sure that the size of the browser instance where the text search is performed isn't empty.

Parameters
texta text to search.
optionsthe parameters such as direction and match case.
callbacka callback for obtaining the search result.

◆ find() [2/2]

virtual void molybden::TextFinder::find ( const std::string &  text,
FindResultCallback  callback 
)
pure virtual

Performs search of the given text, highlights all matches and selects the first match on the currently loaded web page.

Subsequent calls of this method with the same text select the next match.

If this method is invoked after stopFindingAndKeepSelection() then the search will start from the last selected match, and if after stopFindingAndClearSelection() then the search will start from the first match.

If the search is still in progress, but the page content is already changed, then the search result will be displayed for the new content of the page (different number of matches, and the next selected match).

The search is performed only through a visible content on the loaded web page. If some text is presented on the web page, but due to CSS rules it is not visible, the text finder will not check this content during search. Also, it does not find text on the web pages with an empty size, so make sure that the size of the browser instance where the text search is performed isn't empty.

Parameters
texta text to search.
callbacka callback for obtaining the search result.

The documentation for this class was generated from the following file: