pip install undetected_chromedriver webdriver_manager

init[source]

init(*arguments)

quit[source]

quit()

# def init(*arguments):
#     chrome_options = webdriver.ChromeOptions()
#     for argument in arguments:
#         if isinstance(argument, str):
#             chrome_options.add_argument(argument)
#     global driver
#     driver = webdriver.Chrome(options = chrome_options)
init('--user-data-dir=C:\\Users\\seii-saintway\\Downloads\\chrome-profile')

Logging


Using Text-based Search for Browser Automation

ok[source]

ok()

last[source]

last()

new[source]

new(url)

close[source]

close()

find_elements[source]

find_elements(prompt, exactly=True)

find_elements[source]

find_elements(prompt, exactly=True)

find_element[source]

find_element(prompt, closest_prompt=None)

click[source]

click(prompt, closest_prompt=None)

input[source]

input(prompt, text, closest_prompt=None)


Using Selenium for Static Inspection of Page Appearance

image_hash[source]

image_hash(image_path)

Calculate the hash value of the image

screen_hash[source]

screen_hash()

wait[source]

wait(timeout=1.7976931348623157e+308, stability_duration=1.0, check_interval=0.5)

Wait until the screenshot does not change.

Args: timeout: how long to wait for stabilization (seconds) stability_duration: duration for stabilization (seconds) check_interval: check interval (seconds)


Using Airtest for Browser Automation

pip install airtest

find_position[source]

find_position(image, timeout=1.0, threshold=0.9, interval=0.5, intervalfunc=None)

Search for image template in the screen until timeout

Args: path: image file path to be found in screenshot timeout: time interval how long to look for the image template threshold: default is None interval: sleep interval before next attempt to find the image template intervalfunc: function that is executed after unsuccessful attempt to find the image template

Raises: TargetNotFoundError: when image template is not found in screenshot

Returns: TargetNotFoundError if image template not found, otherwise returns the position where the image template has been found in screenshot

inject[source]

inject()

get_mouse_position[source]

get_mouse_position()

move_to_center[source]

move_to_center()

move_and_click[source]

move_and_click(x, y)

exists[source]

exists(image)

touch[source]

touch(image, text=None)

fill[source]

fill(text)


Using Selenium for Printing to PNG and PDF

pip install markdown

convert_md_with_ruby_to_html[source]

convert_md_with_ruby_to_html(md_file_path)

Convert Markdown files containing tags into HTML file

convert_html_with_ruby_to_png[source]

convert_html_with_ruby_to_png(html_file_path)

Use Selenium to print the HTML file as PNG

convert_md_with_ruby_to_png[source]

convert_md_with_ruby_to_png(md_file_path)

Convert the Markdown file containing tags into PNG

dialog_for_printing[source]

dialog_for_printing(timeout=inf)

Dialog for printing to PDF

convert_html_with_ruby_to_pdf[source]

convert_html_with_ruby_to_pdf(html_file_path)

Use Selenium to print the HTML file as PDF

convert_md_with_ruby_to_pdf[source]

convert_md_with_ruby_to_pdf(md_file_path)

Convert the Markdown file containing tags into PDF


init('--lang=en')
convert_md_with_ruby_to_png('2024-11-21.md')
convert_md_with_ruby_to_pdf('2024-11-21.md')