Skip to content

Selenium Service

flowtask.interfaces.selenium_service

SeleniumService

SeleniumService(*args, **kwargs)

Bases: ABC

SeleniumService.

Interface for making HTTP connections using Selenium.

get_driver async

get_driver()

Return a Selenium Driver instance for Firefox, Edge, Safari, WebKitGTK or Chrome.

This method configures the browser based on instance flags (such as: - self.use_firefox, self.use_edge, self.use_safari, self.use_webkit - self.use_proxy, self._free_proxy, self.use_undetected - self.as_mobile for mobile emulation (Chrome-only) - self.enable_http2 (if False, HTTP/2 will be disabled)

It applies a common set of options (stored in self.chrome_options) to all browsers and adds proxy settings (if configured) to the options and/or desired capabilities.

Returns:

Type Description

A Selenium WebDriver instance.

get_page async

get_page(url, cookies=None, retries=3, backoff_delay=2)

get_page with selenium.

Get one page using Selenium.

get_soup

get_soup(content, parser='html.parser')

Get a BeautifulSoup Object.

parse_cookies

parse_cookies(cookie_pair)

Parse the Cookies.

save_screenshot

save_screenshot(filename)

Saving and Screenshot of entire Page.

search_google_cse async

search_google_cse(query, max_results=5)

Search Google Custom Search Engine (CSE) using Selenium.

Parameters:

Name Type Description Default
query str

The search query.

required
max_results int

Maximum number of search results to return.

5

Returns:

Type Description

list[dict]: A list of search results with 'title' and 'link'.