Create
create(url, wait=True, timeout=100, edge_path=None)
Description
Creates an Edge object.
Parameters
url<str> The URL to open.
wait<bool> Specifies whether to wait for the page to finish loading.
timeout<int> The timeout in seconds. The default is 100.
edge_path<str> The path to the msedge.exe file.
If set to
None, the system automatically searches in the%ProgramFiles%and%ProgramFiles(x86)%directories.If specified, this must be the full path to
msedge.exe, for example,C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe.
Return value
Returns an EdgeTab object.<EdgeTab>
Example
# Note: This method requires the Alibaba Cloud RPA extension for Edge to be installed and enabled.
page = rpa.app.edge.create('www.alibabacloud.com')Catch
catch(name, mode='title', pattern='contain', timeout=10)
Description
Catches an already open page.
Parameters
name<str> The title or URL of the page.
mode<str> The page matching type.
Options:
title: Matches by page title.url: Matches by page URL.
pattern<str> The page matching pattern.
Options:
equal: Performs an exact match.
contain: Checks if the target string contains thenamevalue.regular: Performs a regular expression match.
Return value
Returns an EdgeTab object.<EdgeTab>
Example
# Note: This method requires the Alibaba Cloud RPA extension for Edge to be installed and enabled. Ensure the target webpage is open before calling this method.
page = rpa.app.edge.catch('Alibaba Cloud')Catch specific pages
catch_specific_pages(name, mode='title', pattern='contain')
Description
Catches all pages that match the specified criteria.
Parameters
name<str> The title or URL of the page.
mode<str> The page matching type.
Options:
title: Matches by page title.url: Matches by page URL.
pattern<str> The page matching pattern.
Options:
equal: Performs an exact match.
contain: Checks if the target string contains thenamevalue.regular: Performs a regular expression match.
Return value
Returns a list of EdgeTab objects.<list>
Example
# Note: This method requires the Alibaba Cloud RPA extension for Edge to be installed and enabled. Ensure at least one matching webpage is open before calling this method.
page_list = rpa.app.edge.catch_specific_pages('Alibaba Cloud')Catch all pages
catch_all_pages()
Description
Returns a list of EdgeTab objects for all open pages.
Example
# Note: This method requires the Alibaba Cloud RPA extension for Edge to be installed and enabled.
page_list = rpa.app.edge.catch_all_pages()Catch activated pages
catch_activated_pages()
Description
Returns a list of EdgeTab objects for all active pages.
Example
# Note: This method requires the Alibaba Cloud RPA extension for Edge to be installed and enabled.
# If multiple Edge windows are open, this method returns the active tab from each window.
page_list = rpa.app.edge.catch_activated_pages()Close all
close_all()
Description
Closes all open pages.
Example
# Note: This method requires the Alibaba Cloud RPA extension for Edge to be installed and enabled.
rpa.app.edge.close_all()Minimize
minimize()
Description
Minimizes the browser window.
Example
# Note: This method requires the Alibaba Cloud RPA extension for Edge to be installed and enabled.
# If multiple Edge windows are open, this method minimizes only one.
rpa.app.edge.minimize()Restore
restore()
Description
Restores the browser window.
Example
# Note: This method requires the Alibaba Cloud RPA extension for Edge to be installed and enabled.
# If multiple Edge windows are open, this method restores only one.
rpa.app.edge.restore()Catch from element name
catch_from_element_name(element)
Description
Catches a page using an element name.
Parameters
element<str> The name of the element.
Return value
Returns an EdgeTab object.
Example
# Note: This method requires the Alibaba Cloud RPA extension for Edge to be installed and enabled.
page = rpa.app.edge.catch_from_element_name('Baidu search box')
page.input_text('Baidu search box','Alibaba Cloud')Maximize
maximize()
Description
Maximizes the browser window.
Example
# Note: This method requires the Alibaba Cloud RPA extension for Edge to be installed and enabled.
# If multiple Edge windows are open, this method maximizes only one.
rpa.app.edge.maximize()Get cookies
get_cookies(url=None, domain=None, name=None)
Description
Gets cookies that match the specified filters.
Parameters
url<str> Filters the results to cookies accessible from the given URL.
domain<str> Filters the results to cookies from the given domain or its subdomains.
name<str> Filters cookies by name.
Return value
Returns a list of cookie objects that match the filters.<list>
Example
# Note: This method requires the Alibaba Cloud RPA extension for Edge to be installed and enabled.
# The `url` parameter requires a complete URL including the scheme (e.g., `https://`).
cookies = rpa.app.edge.get_cookies(url='https://www.alibabacloud.com')Remove cookie
remove_cookie(url, name)
Description
Removes a cookie specified by its name and URL.
Parameters
url<str> The URL associated with the cookie.
name<str> The name of the cookie to remove.
Example
# Note: This method requires the Alibaba Cloud RPA extension for Edge to be installed and enabled.
# The `url` parameter requires a complete URL including the scheme (e.g., `https://`).
rpa.app.edge.remove_cookie('https://www.baidu.com','domain')Set cookie
set_cookie(url, name, domain=None, value=None, path=None, secure=False, http_only=False, expiration_date=None)
Description
Sets a cookie.
Parameters
url<str> The URL to associate with the cookie.
name<str> The name of the cookie.
domain<str> The cookie's domain. If not specified, the cookie is host-only.
value<str> The cookie's value. Defaults to an empty string if not specified.
path<str> The cookie's path. Defaults to the path from the url parameter.
secure<bool> If True, the cookie is marked as secure.
http_only<bool> If True, the cookie is marked as HttpOnly.
expiration_date<str> The expiration date of the cookie.
Example
# Note: This method requires the Alibaba Cloud RPA extension for Edge to be installed and enabled.
# The `url` parameter requires a complete URL including the scheme (e.g., `https://`).
rpa.app.edge.set_cookie('https://www.baidu.com','rpa_test',value='Alibaba Cloud RPA Test_www.alibabacloud.com')